【问题标题】:.htaccess not fallowing the requested url | codeigniter url routing.htaccess 没有放弃请求的 url | codeigniter url 路由
【发布时间】:2015-01-04 08:03:34
【问题描述】:

原网址:

https://www.doctor24.ro/i/index.php/en/property/54a402a9d4f13/Sapientek-Ecografie

.htaccess 后请求的 url:

https://www.doctor24.ro/i/cabinet/Sapientek-Ecografie

.htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^cabinet/(.*)$ ./index.php/en/property/([a-zA-Z0-9-=_?]+)*$

有什么问题?

更新:

我正在使用的脚本使用 codeigniter url 路由

【问题讨论】:

  • “54a402a9d4f13”从何而来?
  • 我的意思是,属性 id 是如何进入 .htaccess RewriteRule 的?

标签: php apache .htaccess codeigniter mod-rewrite


【解决方案1】:

你不能在右手边使用正则表达式,只能使用反向引用变量。看起来您将此 .htaccess 放在 /i/ 文件夹中。您还需要使用适当的RewriteBase

Options +FollowSymLinks
RewriteEngine On
RewriteBase /i/

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^cabinet/(.*)$ index.php/en/property/$1 [L,NC]

【讨论】:

    【解决方案2】:

    更新现在试试下面:

    RewriteRule ^i/cabinet/(.*)$ i/index.php/en/property/$1
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多