当我尝试将其重定向到我的网站根目录时。
例如:
https://example.com/video_cat/a-respiratory/
我希望所有下划线都替换为-
(连字符),但是当我尝试这样做时,我会重定向到https://example.com
这是我的.htaccess
配置
RewriteEngine On
RewriteRule ^([^_]*)_(.*)$ /$1-$2 [R=301,L]
RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301]
.htaccess
文件:#BEGIN CORS access to staging environments
#start start's here
Options +FollowSymLinks
RewriteEngine on
#RewriteRule ^([^_]*)_+(.*)$ /$1-$2-$3 [L,NC,R=302]
RewriteBase /
RewriteRule ^([^_]*)_(.*)$ /$1-$2 [R=301,L]
RewriteRule