View Single Post
Old 02-25-2006, 10:46 AM   #1 (permalink)
Matthew Doucette
Inactive
 
Join Date: 02-18-06
Posts: 13
iTrader: 0 / 0%
Latest Blog:
None

Matthew Doucette is liked by many
.htaccess redirection problem; URL without ending slash 404s

Check this out:

http://xona.com/domainhacks/ works
http://www.xona.com/domainhacks/ works (and forwards to above URL)

However, remove the ending slash:
http://xona.com/domainhacks works
http://www.xona.com/domainhacks 404s!!!!!!!!!!!!!

Why? Here are the full .htaccess files, as I left everything in as experience has told me to never make assumptions:

xona.com root dir:
(This rewrite is supposed to change "www.xona.com" to "xona.com" everywhere.)
Code:
ErrorDocument 400 http://xona.com/error/400.html ErrorDocument 401 http://xona.com/error/401.html ErrorDocument 403 http://xona.com/error/403.html ErrorDocument 404 http://xona.com/error/404.html ErrorDocument 500 http://xona.com/error/500.html Options +Includes Options -Indexes XBitHack On RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^xona\.com [NC] RewriteRule ^(.*) http://xona.com/$1 [R=301]
--- I believe the above .htaccess to be perfect. I believe the problem is in the following .htaccess file below. I may be wrong. ---

xona.com/domainhacks dir:
(This rewrite is supposed to change "www.xona.com/domainhacks" to "xona.com/domainhacks" everywhere. The reason the root .htaccess file listed above does not handle this, is because this .htaccess file overrides it simply by existing.)
Code:
RewriteEngine On RewriteCond %{HTTP_HOST} !^xona\.com [NC] RewriteRule ^(.*)$ http://xona.com/domainhacks/$1 [R=301] RewriteRule ^search(.*)$ s.cgi$1 [NC] RewriteRule ^suggestions(.*)$ suggest$1 [R=301]
(I hate asking for help with this sort of thing, as I usually figure it out myself shortly afterwards. But so far I am stuck so it can't hurt.)
Matthew Doucette is offline   Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links