在我的htaccess文件中,我有一个,它应该从路径中删除index.php?
,并使路径看起来像这样:video/:AccountId/:recordId
,但有些东西工作不正常。它不再重写,我只能通过拥有index.php来使url工作?标签,所以它看起来像:video/index.php?/:AccountId/:recordId
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /video
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
我不能只是删除它,因为客户已经有了video/:AccountId/:recordId
。我不想让他们通过电子邮件来更改他们端的某些内容来实现这一点,我也希望有人知道如何将该url重定向到包含index.php的url?因为总的来说,我不在乎它是否存在,这是对前几支球队的保留。
使用您显示的示例,请尝试以下htaccess规则文件。确保你的htaccess文件与视频或URL文件夹的第一级一起存在,也确保index.php存在于该文件夹中,例如:`.htaccess和video同时存在,index.php在视频文件夹中(。
在测试URL之前,请确保清除浏览器缓存。
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)/(.*)/?$ /$1/index.php?/$2/$3 [QSA,L]