Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-06-2009, 07:17 PM   PM User | #1
eddiegiese
New to the CF scene

 
Join Date: Oct 2009
Location: York, PA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
eddiegiese is an unknown quantity at this point
htaccess problem - no-www with pretty urls

I'm trying to enable no-www in conjunction with taking a simple file (like /about.php) and rewriting it to /about/ but I keep getting a 406 error. Weird. Here's my code in the htaccess file. Any help is greatly appreciated as I've exhausted about 1000 different options.

Code:
RewriteEngine On
Options +FollowSymLinks
#
#Sub-dir
RewriteBase /
#
# no-www rewrite rule
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301]
#
# 301 Redirect all requests that don't contain a dot or trailing
# slash to include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301]
#
# Rewrites urls to be pretty but only rewrites
# if the requested URL is not a file or directory
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^about/?$ about.php [NC,L]
#
# Blocks image hotlinking
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^http://.*$
RewriteRule \.(jpe?g|gif|bmp|png)$ - [F] 
#
# serve custom errors
ErrorDocument 404 /404.php
eddiegiese is offline   Reply With Quote
Reply

Bookmarks

Tags
apache, htaccess, mod_rewrite, rewrite, url

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:38 PM.


Advertisement
Log in to turn off these ads.