在Wordpress上,我们希望我们的网址指向:
但是,而无需更改用户的网址。
我尝试过这个:
RewriteRule ^education/(.*) /$1 [R=301]
还有
RewriteCond %{REQUEST_URL} /education
RewriteRule ^(.*) $1 [P]
.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# RewriteRule ^education/(.*) /$1 [R=301]
# RewriteCond %{REQUEST_URL} /education
# RewriteRule ^(.*) $1 [P]
# RewriteRule /education ^$ [L]
# RewriteRule /education ^$ [R=301,NC,L]
# RewriteCond %{HTTP_HOST} /education
# RewriteRule ^(.*) $1 [P]
RewriteRule ^/education/(.*) /$1
</IfModule>
它没有用:它重定向到新的url,但它不断更改url!
请问有什么想法吗?
答案 0 :(得分:1)
修改您对此规则的重写
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^education\/(.*) /$1 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>