当有人输入/ 5或其他内容时,我有.htaccess重定向,但如果他们只输入域名,我该如何使其不重定向?
所以southeast.tv/5/e将重定向, 但是东南.tv只会留在东南.tv
现在是我的代码:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)/?([^/]*)/?$ http://southeast.tv/index.php?v=$1&t=$2
答案 0 :(得分:0)
仅RewriteCond
添加/
以取消对^[/]?$
的请求:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
# Only rewrite if the request is not for `/` The ? probably isn't needed
Rewritecond %{REQUEST_URI} !^[/]?$
RewriteRule ^([^/]*)/?([^/]*)/?$ http://southeast.tv/index.php?v=$1&t=$2 [L,R=301]