简体   繁体   English

.htaccess从Wordpress URL重定向到普通站点URL

[英].htaccess redirect from Wordpress URL to Normal site URL

I have rebuild a site. 我已经重建了一个站点。 The old site was WordPress and new site is normal php site with same amount of pages. 旧站点是WordPress,新站点是具有相同页面数量的普通php站点。

I do not want to lose the outside plus google links to this pages and need to do a redirect in .htaccess 我不想失去外部以及与此页面的Google链接,而需要在.htaccess中进行重定向

I know how to do this with normal links eg www.domain1.com/guesthouse.html to www.domain2.com/guesthouse.php 我知道如何使用常规链接(例如,www.domain1.com / guesthouse.html到www.domain2.com/guesthouse.php)进行此操作

I do not understand the wordpress link with no ".php or .html" at the end of the link. 我不理解wordpress链接的末尾没有“ .php或.html”链接。

The old link is www.doamin.com/guesthouse/ (only this without .html or .php) New link must be www.domain.com/gusethouse.php 旧链接为www.doamin.com/guesthouse/(仅此链接不含.html或.php),新链接必须为www.domain.com/gusethouse.php。

The WordPress .htaccess file looks like this WordPress .htaccess文件如下所示

`# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress`

Can I delete the above code and replace with 我可以删除上面的代码并替换为

`Redirect 301 /guesthouse/  http://www.domain.com/guesthouse.php`

or must I add it to the existing .htaccess code. 还是必须将其添加到现有的.htaccess代码中。

Do not know how to do it right, please help. 不知道该怎么做才对,请帮忙。

Thank you. 谢谢。

The .htaccess file will execute prior to your PHP interpreting engine running. .htaccess文件将在您的PHP解释引擎运行之前执行。 This means that you're higher in the execution chain than the Wordpress software. 这意味着您在执行链中比Wordpress软件更高。

If you're not going to use your Wordpress website anymore, then there's no reason to send requests to it! 如果您不再使用Wordpress网站,则没有理由向其发送请求!

Instead, just simply remove all of that code, and rewrite the URL's accordingly. 相反,只需删除所有这些代码,并相应地重写URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM