如何启用此功能:
如果我输入:maggew.com/abcxyz
你将被重定向到mr.maggew.com/abcxyz
如果我键入:maggew.com/privacy
你将被重定向到mr.maggew.com/privacy
如果我键入:maggew.com/refund
你将被重定向到mr.maggew.com/refund
如果我输入:maggew.com/contact
你将被重定向到mr.maggew.com/contact
等等......等等......
- 我在1&1上使用共享主机,现在我有了一个数字海洋水滴。
我尝试使用HTACCESS REDIRECT GENERATOR,但运气不佳。*
以下是我当前的.htaccess:
# REDIRECTS STORE
redirect 301 /shop http://mr.maggew.com/store
redirect 301 /market http://mr.maggew.com/store
redirect 301 /outlet http://mr.maggew.com/store
redirect 301 /bazaar http://mr.maggew.com/store
redirect 301 /boutique http://mr.maggew.com/store
# PROTECT WP-CONFIG.PHP
<files wp-config.php>
order allow,deny
deny from all
</files>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
#force subdomain of mr.maggew.com
RewriteCond %{HTTP_HOST} !^mr\.
RewriteRule (.*) http://mr.maggew.com%{REQUEST_URI} [R,L,QSA]
3条答案
按热度按时间oiopk7p51#
如果你的内容中有旧的url示例,你可以使用类似这样的东西来更新到新的。我不确定这有多有效。
http://www.wpbeginner.com/plugins/how-to-update-urls-when-moving-your-wordpress-site/
或者您可以使用http://wp-cli.org/修改数据库示例,或者您可以使用mysql命令行搜索和替换。
所有你的网址从内容和页面引用网址是存储在数据库中.你可以做一个大规模的搜索和替换如果你知道你在做什么.
ymzxtsji2#
假设您在相同的主机和目录结构上,您可以在HTTP_HOST中添加一个条件来检查子域,如果子域丢失,您可以重定向到它。
备选
moiiocjp3#
下面的说明在2023年不起作用,所以我做研究。
对我来说,你可以用...
详情请访问https://www.arnlweb.com/forums/web-development/what-is-htaccess-redirection-how-to-use-it