【问题标题】:mod rewrite not working on Servermod重写在服务器上不起作用
【发布时间】:2016-10-31 15:55:14
【问题描述】:

所以我需要重定向所有以“ordermodel”开头的 url 的请求。这适用于我的本地主机,但是当我将它上传到我的服务器上时,它没有重定向到 index.php。下面是我的htaccess。

                    <IfModule mod_rewrite.c>
                        RewriteEngine On
                        RewriteCond %{REQUEST_FILENAME} !  
                        (aHirasTailoredFit.php|admin_CI)
                        RewriteRule ordermodel index.php [QSA,L]
                    </IfModule>

这是我的本地网址:http://localhost/BACKUP-HIRAS-JUNE-27-2016/HirasTailoredFit-DEV/ - 它在这里工作

但不在这里

http://www.example.com/QA-OrderSheet/aHirasTailoredFit.php

【问题讨论】:

    标签: php apache .htaccess mod-rewrite server


    【解决方案1】:

    你需要允许覆盖那里..

     <Directory "/path/to/document/root/">
       AllowOverride All
       Allow from All
     </Directory>
    

    并请确认您已从 Apache 文件夹的 Httpdconfig 文件中删除 #。

    【讨论】:

    • 谢谢你的回答,我是这个服务器的新手,我应该把这些代码放在哪里?那是一个单独的文件吗?
    • 你用的是linux还是window?
    • 我正在使用 Windows。它在本地工作,但不在我的服务器上工作
    • 首先你必须在服务器上检查是否启用了 Mod_rewrite 要检查是否启用了 mod_rewrite 模块,请在服务器的根文件夹中创建一个新的 php 文件。输入以下 phpinfo();从浏览器访问您创建的文件。在加载的模块中查找“mod_rewrite”。如果已启用,您会将其视为“加载的模块”
    • 已启用,我想我缺少这部分'RewriteRule ordermodel index.php [QSA,L]'
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-01
    • 2018-04-13
    • 1970-01-01
    • 1970-01-01
    • 2015-10-28
    相关资源
    最近更新 更多