Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- RewriteRules and .htaccess


mdsww - 6:25 am on Oct 7, 2011 (gmt 0)


Hi Lucy,

I am ugrading an old website, hence the space character appearing in the page name. I can assure you I would not do this myself. ;)

Here is my final htaccess file with all of the suggestions and help along the way:


RewriteEngine On

RewriteBase /

##### Protect images from hotlinking
RewriteCond %{HTTP_REFERER} !^-?$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/ [NC]
RewriteRule \.(gif|jpe?g|png)$ - [F]

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

##### Resolve index html/php page to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html?)\ HTTP/

##### Resolve static html pages to static version
RewriteRule ^(about|company|services|support|contact)\.html?$ http://www.example.com/$1-static.html [R=301,L]

##### Rewrite function 1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)$ blog-article.php?url=$1 [L]

##### Rewrite function 2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ article.php?url=$1 [L]


Can anyone see an issue with this file in production?


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