开发者

Strange htaccess Problem

I have a website with this in the .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %开发者_开发百科{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?menu=$1 [L,QSA]

#DirectoryIndex index.php

My problem is even, if I change a single letter the website is rendering a 500 Error. Even if I empty complete file, it still shows me the 500 Error.

What I want to do is, there is a page like this on the domain

http://www.example.co.uk/brochure/generate.php

The file generate.php does exist in /brochure/ directory.

But still the generate.php does not load and it is loading the index.php file.

Any help?


Try the following which I know should work:

<IfModule mod_rewrite.c>
    #Turn the Rewrite Engine ON
    RewriteEngine On

    #Set the base where to rewrite the requests
    RewriteBase /

    #Allow direct file access
    RewriteCond %{REQUEST_FILENAME} !-f

    #Allow direct directory access
    RewriteCond %{REQUEST_FILENAME} !-d

    #Disallow certain files.
    RewriteCond %{REQUEST_FILENAME} !brochure\/generate\.php$

    #Rewrite URLS To GET[menu] and make sure this is the last rule.
    RewriteRule ^(.*)$ index.php?menu=$1 [L]
</IfModule>

if you do not see any rewriting taking palce then check to see the module for rewrite is installed.


If an empty file triggers a 500 status code as well, then the error is somewhere else: you are not editing the real .htaccess file being used by Apache, the error comes from the application, etc.

In any case, you should find the error log: that's where the exact details are shown. In Linux, it's normally under /var/log/httpd. In Windows, it can be under %ProgramFiles%\Apache Software Foundation\Apache2.2\logs. If it's a shared hosting account, you'll probably have an "Errors" or "Logs" feature in your control panel.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜