请不要使用URL重定向

时间:2016-10-13 01:17:33

标签: .htaccess mod-rewrite url-redirection

我的网址重定向有点问题。

这是我的htaccess文件:

ModPagespeed off

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301]

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^firma/(\d+)*$ index.php?company=$1

当我通过https://example.com/firma/asd/进入我的网站时,我只获得标准的404页面:

Not Found    
The requested URL /firma/asd/ was not found on this server.

任何人都可以告诉我我的重定向是什么? index.php.htaccess文件位于我的网站空间的根目录中。 我玩了一些重定向,并删除了Chrome中的缓存,以确保这不是问题。

欢迎任何建议。

1 个答案:

答案 0 :(得分:1)

(\ d +)* $与asd不匹配但只有数字或没有:

https://example.com/firma/
https://example.com/firma/123

顺便说一下。更好用^ firma /(\ d +)?$