Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Htaccess Redirecting Questions


lucy24 - 4:36 am on Jan 29, 2013 (gmt 0)


RewriteRule ^(index)$ example.com/examplepage.php [R=301,L,NC]
Please say that was a typo. Or at least shorthand-for-purposes-of-posting :)

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

Both with and without brackets around the PHP and it doesnt redirect yet using this does

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


Ugh, ugh. Either we are all overlooking an embarrassingly obvious typo, or something's wrong there. Does the intermediate version redirect? Like this:

^([^.]+)\.php$

(The closing anchor is purely for insurance against malicious and/or malformed requests.)

The form .* is potentially calamitous for various reasons, including hypothetical requests for www.example.com/.php which you would probably not want to redirect.


Thread source:: http://www.webmasterworld.com/apache/4537934.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com