简体   繁体   中英

.htaccess redirect to subfolder except for some url WP+Joomla

I've installed a Joomla website in a subfolder of a WordPress site root domain. My goal is to redirect all old url request to new Joomla homepage, except some url. Assuming www.exampledomain.com is the WP root site, www.exampledomain.com/newsite/ is the new subfolder Joomla site and www.exampledomain.com/some/ is path not to redirect, how can I modify WP .htaccess? Note that /some/ is not a root subfolder. Thanks.

If you have mod_rewrite enabled in Apache, you can manually add all of your redirect rules into the WordPress .htaccess file. Here's an explanation of how to do it on Apache's website.

Note that Apache will read and apply all of the .htaccess files between your server root (eg /var/www/html by default on a Debian server) and the directory you are serving from ( /newsite in your example). There's a possibility you'll have conflicting directives in the WordPress .htaccess file and the Joomla .htaccess file.

You can add an exception to not apply the rule when it matches the /some path

 RewriteEngine On RewriteCond %{REQUEST_URI} !^/some RewriteRule (.*) /newsite/$1 [L,R=301] 

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