Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
mod rewrite for old site content with new Textpattern install.
I have a site that has some older site content in a sub directory along side a textpattern install.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
This is the existing one for TXP. Can anyone let me know how I can modify this to say “if there’s a file/directory existing in the ‘old_content’ folder then rewrite to that folder in the root, otherwise keep using txp’s existing rewrite.”
so /old_content/sub_dir/ can be called from /sub_dir/ through a rewrite and not interfere with the clean url rewrite above. I have been pouring over stackoverflow and google for the past few hours and have not come up with anything other than 500 errors.
Last edited by ecklesroad (2012-12-24 20:06:21)
Offline
Re: mod rewrite for old site content with new Textpattern install.
Hi Nate.
I’d like to help you with this, but I’m not sure I understood exactly what you are after of.
Will you be storing the old content at /path/to/public/old_content/sub_dir/
and you want to be able to access it at an URL like http://example.com/sub_dir/
(which should be internally rewritten to /old_content/sub_dir
?
Offline
Re: mod rewrite for old site content with new Textpattern install.
That’s exactly what i’m trying to do Julián, I just can’t get my head around it.
Offline
Re: mod rewrite for old site content with new Textpattern install.
Hi Nate.
You may consider this alternative solution (which saves you from having to use mod_rewrite): to create a sub_dir
symlink that poins to /old_content/sub_dir
.
This way, you totally avoid having to mess with .htaccess
and rewrites.
Creating a symlink on some hostings may be a bit more difficult than expected.
If you have shell access (via SSH) then it’s usually a matter of just running:
$ ln -s /old_content/sub_dir sub_dir
If you don’t have shell access, try this approach using PHP
perishablepress.com/use-php-to-create-symbolic-links-without-shell-access/
Offline