开发者

Wrong reported 404 using by Apache (.htaccess rewrite)

开发者 https://www.devze.com 2023-03-31 08:04 出处:网络
I have this url http://xxxxxxxxx.com/account/session/login/redirect/%2Fhotel%2Frooms%2Findex%2Fhot_id%2F1 which uses Zend Framework (PHP). With help of a .htaccess

I have this url http://xxxxxxxxx.com/account/session/login/redirect/%2Fhotel%2Frooms%2Findex%2Fhot_id%2F1 which uses Zend Framework (PHP). With help of a .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]

The thing is i'm getting a 404 Not found. To make sure it was Apache, i exited the index.php main file just when it starts and apache still reports 404. No code of php gets to be executed before that exit.

EDIT

The apache domlog for my domain shows this line

190.78.208.30 - - [25/Aug/2011:17:48:17 -0430] "GET /account/session/login/redirect/Fhotel开发者_如何学运维%2Frooms%2Findex%2Fhot_id%2F1 HTTP/1.1" 404 25821 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0"

But there are no lines associated in the error_log

EDIT 2

If useful i'm running Apache 2.2.19, PHP 5.3.6, cpanel 11.30.2, CentOS 5.6

Wrong reported 404 using by Apache (.htaccess rewrite)

Please notice the 404 not found. When i exit the index.php before executing anything else the 404 still comes up. I can be sure the .htaccess is being read. Following a recommendation i put a

SetEnv MYENV 1

And is showing up in a phpinfo() in the same domain. I just double checked my access_log and error_log and remain like described above.

Any ideas why this is happening?


Are you sure your .htaccess file is being read by Apache? Make sure that By:

  1. You have permissions to override values in your website directory. to have this you should have something like this in your Apache configuration file:

    <Directory /var/www/html>

    AllowOverride All
    

    </Directory>

    replace /var/www/html with the path to your website public directory

  2. Apache has permissions to read your .htaccess file.

This way Apache could read and apply configurations in your .htaccess file.

To test it, set an environment variable in your .htaccess file:

SetEnv MYENV 1

and then use the phpinfo() function in your index.php file and search for the environment variable. If the environment variable is not present in your phpinfo() output, it means the .htaccess file is not parsed by Apache.

0

精彩评论

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