问题描述
我使用甲基苯丙胺开发的Web应用程序在我的Mac。该应用程序使用.htaccess文件,它包含在根目录下。在我的本地MAMP环境中进行测试时,一切伟大的工作。然而,当我搬到我的托管服务器(专用服务器运行Red Hat Linux),在.htaccess文件我重写规则都不能正常工作。例如,当在我的网站用户登录重写规则需要他们 HTTP://www.mysite。 COM /认证/登录因为它应该(它出现在.htaccess中的重写规则的工作)。不过,我得到一个404文件未找到错误。任何人都可以看到的问题是什么呢?这里是code在.htaccess文件中:
的ErrorDocument 404的index.php
的DirectoryIndex index.php文件
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php?网页= $ 1 [L,QSA]
< / IfModule>
选项-Indexes
是的AllowOverride
指令在生产服务器上设置正确?
http://httpd.apache.org/docs/2.0/ MOD / core.html#的AllowOverride
I developed a web app on my Mac using MAMP. The app uses a .htaccess file, which is contained in the root directory. Everything worked great when testing on my local MAMP environment. However, when I moved to my hosted server (dedicated server running Red Hat Linux), my rewrite rules in the .htaccess file are not working properly. For example, when a user logs in to my site the rewrite rule takes them to http://www.mysite.com/authenticate/login as it should (it appears the rewrite rule in .htaccess worked). However, I get a 404 file not found error. Can anyone see what the problem is? Here is the code in the .htaccess file:
ErrorDocument 404 /index.php
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
</IfModule>
Options -indexes
Is the AllowOverride
directive correctly set on the production server?
http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride
这篇关于为什么我的本地MAMP测试服务器上做我的.htaccess文件做工精细,但并没有我的Linux生产服务器上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!