简体   繁体   中英

Redirect all Wordpress url's to landing page except login url

I have gone through all the somewhat similar questions here, and tried out some apache cheat sheet rules I have bookmarked but no luck. In a nutshell I have a wordpress site with pages, posts, categories and tags all part of my xml sitemap. I would like to redirect everything to the home page except the login url for wordpress (example.com/wp-login.php) as I need to get back in.

I am putting up a landing page on this url while I work on a rebrand, and would like to 301 everything to the landing page. I guess I could take every url in my sitemap and put them in a redirect plugin but I am looking for a more direct htaccess solution.

You can use .htaccess with the code below

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
rewriteRule ^/index\\.php$ http://www.yoursite.com/ [R=301,L]

Hope it help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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