Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Hide/changing .php?=


g1smd - 1:47 pm on Oct 27, 2012 (gmt 0)


A few points to get you on the right track.

Add a blank line after every RewriteRule so you can see each ruleset more clearly.

Comment the code indicating which rules redirect and which rules rewrite.

You must list the external redirects before the internal rewrites. The final external redirect is usually the non-www/www canonical redirect, listed immediately before the first internal rewrite.

As I said before, you do not need the line
RewriteCond %{REQUEST_FILENAME} !-f
because you will not have extensionless files on the server harddrive.

^name=([-a-zA-Z0-9_]*)(&|$) - the * allows a blank name. Use a + here.


If you are redirecting requests with name= parameter in the requested URL to friendly URLs and then rewriting requests for friendly URLs to an internal filepath and passing a name= parameter to it, the rules will loop. This happens because the internal rewritten request will rematch the rule that produces the redirect. This will expose the rewritten internal filepath back out on the web as a new URL and this request will be redirected again. To stop this happening, the rule that redirects MUST also test THE_REQUEST in a preceding RewriteCond to ensure that only incoming external URL requests for the name= parameter are redirected and not those as a result of a previous internal rewrite.


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