我无法重定向 htaccess 斜杠 301
I can't redirect htaccess slash 301
当我在网站上输入 htaccess 代码时。com/seo。php,它重定向到网站。com/seo,但我想要它做网站。com/seo /
我的 htaccess 代码:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ .php [NC,L]
用这个代替当前的:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ .php [NC,L]
我改变了什么:
RewriteRule ^ %1 [R=301,L]
到 RewriteRule ^ %1/ [R=301,L]
(在 %1
之后添加一个 /
)
别忘了清除缓存。
当我在网站上输入 htaccess 代码时。com/seo。php,它重定向到网站。com/seo,但我想要它做网站。com/seo /
我的 htaccess 代码:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ .php [NC,L]
用这个代替当前的:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ .php [NC,L]
我改变了什么:
RewriteRule ^ %1 [R=301,L]
到 RewriteRule ^ %1/ [R=301,L]
(在 %1
之后添加一个 /
)
别忘了清除缓存。