【问题标题】:Error Re Write Rule错误重写规则
【发布时间】:2013-10-10 21:15:03
【问题描述】:

我正在使用来自学习视频的重写规则

但它不能正常工作

Options +FollowSymLinks
Options -Indexes

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

如果只是输入,我希望它能够接收 http://www.example.com/hmvctest/helloworld

但它只有在我输入时才有效 http://www.example.com/hmvctest/index.php/helloworld

目前只显示“未指定输入文件”我使用 codeigniter 和 cpanel 我已经尝试了下面的两个答案,但仍然没有运气我的网站使用 https

【问题讨论】:

    标签: regex apache .htaccess codeigniter mod-rewrite


    【解决方案1】:

    尝试用这个替换你的规则:

    Options +FollowSymLinks -Indexes -MultiViews
    
    DirectoryIndex index.php
    
    RewriteEngine on
    
    RewriteCond %{REQUEST_URI} !^/(index\.php|images/|robots\.txt) [NC]
    RewriteRule ^ index.php%{REQUEST_URI} [L] 
    

    【讨论】:

    • 我得到了它的工作,我现在使用了一个不同的,也让我也有 https,这也是之后的
    【解决方案2】:
    Use this code
     <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /www.example.com
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        ErrorDocument 404 /index.php
    </IfModule>  
    

    【讨论】:

    • 将example.com更改为我的域后仍然无法工作我有mysql和apache
    猜你喜欢
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-30
    • 2013-11-24
    • 1970-01-01
    相关资源
    最近更新 更多