Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-12-24 20:05:34

ecklesroad
Plugin Author
From: Bemidji, MN
Registered: 2008-02-22
Posts: 119
Website

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

#2 2012-12-27 23:11:34

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2012-12-27 23:16:59

ecklesroad
Plugin Author
From: Bemidji, MN
Registered: 2008-02-22
Posts: 119
Website

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

#4 2012-12-30 23:46:15

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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/


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB