这是我需要做的:WordPress的重建 - 301重定向旧网页(* .PHP),以漂亮的永久链接
旧网页mydomain.com/something.php
新页面在WordPress的重建确定使用漂亮的固定链接,所以他们mydomain.com/something/
我需要弄清楚重写规则应该是什么样子。我已经抓取网络,找不到任何完全一样的东西。
这是我需要做的:WordPress的重建 - 301重定向旧网页(* .PHP),以漂亮的永久链接
旧网页mydomain.com/something.php
新页面在WordPress的重建确定使用漂亮的固定链接,所以他们mydomain.com/something/
我需要弄清楚重写规则应该是什么样子。我已经抓取网络,找不到任何完全一样的东西。
是这样的:(。*)
RewriteEngine On
RewriteRule ^(.*)\.php$ $1/ [R=permanent]
的是.php为之前的字符 “基团”,和$ 1指到该组的字符。因此,只需添加一个斜线到组和发送浏览器到新的URL与HTTP代码301(永久重定向)
试试这个:
RewriteEngine On
RewriteBase/
#Ignore index.php
RewriteCond %{REQUEST_URI} !index\.php
RewriteCond %{REQUEST_URI} !(wp-login|wp-admin|wp-includes)
RewriteCond %{REQUEST_URI} ^(.*)\.php$
RewriteRule ^(.*)\.php$ $1/ [R=301,L]
#"Standard" Wordpress Rewrite Stuff
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/catalog
RewriteRule . /index.php [L]