Reputation: 974
I've just spent the afternoon writing an .htaccess file for a project I am working on.
It works in my test environment but when I transfer it to the live server, I get 404 errors:
The requested URL /albums/hua-hin/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle >the request.
My .htaccess is as follows:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^albums/([^/]+)/image/([^/]+)/([^/]+) /getimage.php?a=$1&i=$2&pt=$3 [NC]
RewriteRule ^albums/([^/]+)/tags/([^/]+) /index.php?a=$1&tag=$2 [NC]
RewriteRule ^albums/([^/]+)/sag/([^/]+) /index.php?a=$1&sag=$2 [NC]
RewriteRule ^albums/([^/]+)/ /index.php?a=$1 [NC]
I wonder if the way my server is set up has anything to do with it. It's a shared account on which I host multiple sites.
www.mymaindomain.com points to the root of (my space on) the server. There is an .htaccess file there which then points all traffic from www.mymaindomain.com to (root)/mymaindomain
this site is located in (root)/anotherdomain, and is directly pointed there.
I have other sites at (root)/domain3, (root)/yetanotherdomain etc; none of which use .htaccess files as far as I remember!
Upvotes: 1
Views: 166
Reputation: 974
OK I have found the issue!
I have a file in the root called albums.php, and all my redirects are basled on /albums/
For some reason, while this didn't cause any issues in the testing environment, it caused the production server to 404 on me. Renaming the albums.php file to something different solved the problem.
Upvotes: 1