2

I want to redirect some old urls to new one and I want this also for the subdomains, but I've a hard time to get this work. Do I miss something in my .htaccess? The redirects won't work for my main site but also the sub domains doesn't work.

And a another question.

If I want to redirect subdomains, but the subdomains have been domain mapped, example sub.domain.com => anotherdomain.com, do I have to use the original SUB domain for redirects or do I use the mapped domain?

This is my .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
    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).*) wp/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
    RewriteRule . index.php [L]
</IfModule>
# END WordPress

Redirects of main site main blogsite

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [nc]

#Redirect 'domain.com/about_us.html' to 'domain.com/about-us'
RewriteRule ^about_us\.html$ /about-us/ [R=301,L]

Redirects for subdomains

RewriteCond %{HTTP_HOST} ^anotherdomain\.com [nc]

#Redirect 'anotherdomain.com/projects.html' to 'anotherdomain.com/projects/summary/'
RewriteRule ^projects\.html$ /projects/summary/ [R=301,L]
Carloscody
  • 96
  • 1
  • 1
  • 9
  • if you're not sure if the htaccess is working, why not test it with this [tool](https://htaccess.madewithlove.be/). – Aurovrata May 31 '18 at 12:17

0 Answers0