开发者

Apache Mod_ReWrite Suddenly Stopped Working

I had mod_rewrite set on my server to rewrite a url like the following

http://www.example.com/1

to

http://www.example.com/index.php?show=1

In order words a URL shortern. Everything was working fine when the system was running under a sub-domain on my development site, but now it just generates a Not Found error, although if I manually enter the url /index.php?show=1 it works fine.

So the only changes is the urls switching from

http://www.site.example.com

to

http://www.site.com

however it's still running开发者_开发知识库 on the same server and the same sub-folder inside public_html on the server just the new domain name has been pointed to that folder.

The folder it's stored in is /public_html/paste

The full .htaccess file running in the directory is

# Set Default File
DirectoryIndex index.php

# Turn ReWrite Engine On
RewriteEngine on

# Create Rule To Write URLs To Shorter Versions
RewriteRule /([a-z0-9]+) /index.php?show=$1

I can't enable RewriteLog as the hosting doesn't allow it for some reason.


It sounds like the AllowOverride directive is not properly set for that folder. In your Apache configuration, you should make sure that the Directory or Vhost you're using for the primary domain has the AllowOverride set to All

http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride


You probably need to specify the RewriteBase directive.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase

I'll also note that Options +FollowSymlinks would be good to have in there too in case you ever turn it off further up the config chain (rewrite wont work without it).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜