Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- urlrewrite and HTML forms


g1smd - 10:54 am on Dec 5, 2012 (gmt 0)


It's rare to fix a problem without seeing a single line of your code, but I've made this error far too many times in the past to let it slip past me these days.


Make sure your file has all redirects listed before any of the rewrites start.

Additionally, the rules should be listed starting with "most specific" (affects the smallest number of URL requests) to "most general" (affects the most number of URL requests). Specifically, make sure that your non-www/www canonicalisation redirect is the last of the redirects.

Make sure you do not use Redirect or RedirectMatch for any of your rules. Convert them all to use RewriteRule with the [R=301,L] flag.

For all rules that redirect, make sure the rule target includes the protocol and canonical hostname.

Make sure you escape all literal periods in patterns.

Add a blank line after every RewriteRule for human readability, and comment each block of code explaining what it should do.


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