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


HaloPlayer - 7:38 am on Nov 6, 2012 (gmt 0)


Thanks I understand now, you are referring to the http:// & www parts of the domain name, so instead of the URL being accessed in two ways e.g. http://www.example.com or http://example.com the rewrite makes a permanenet redirect to the www e.g. http://example.com redirects to http://www.example.com

The code:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{THE_REQUEST} name=([-a-z0-9_]+)
RewriteRule ^book\.php$ http://www.example.com/book/%1? [R=301,L]

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^book/([-a-z0-9_]+)$ /book.php?name=$1 [L]


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