Forum Moderators: phranque

Message Too Old, No Replies

Change one word using htaccess

htaccess change subfolder

         

shady

11:49 am on Jan 27, 2011 (gmt 0)

10+ Year Member



Hi all

Sorry I have not been around for quite a while and I should really know how to do this by now!

I have a site who's urls contain cPath2 and I simply wish to redirect to URLs containing cPath instead. So for example

[fooobarrr.com...]
would redirect to
[fooobarrr.com...]

My .htaccess already contains a "redirective":
RewriteRule ^.+/([a-z_]+\.php.*)$ $1 [L]

Thank you for all your help.

Best regards
Shady

jdMorgan

9:25 pm on Jan 31, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If all "cpath" URLs are always preceded by exactly "/aaa/bbb/ccc/", then

RewriteRule ^aaa/bbb/ccc/index\.php/cpath2/(.+)$ http://www.example.com/aaa/bbb/ccc/index.php/cpath/$1 [R=301,L]

Or, assuming that these "cpath2" URLs could be at any arbitrarily-named "directory" level,

RewriteRule ^([^/]+/)*index\.php/cpath2/(.+)$ http://www.example.com/$1index.php/cpath/$2 [R=301,L]

Jim

shady

7:38 pm on Mar 13, 2011 (gmt 0)

10+ Year Member



Thats great, thank you.