I have a lot of URL, which can't be redirected, or, better, rewrited with mod_rewrite in .htaccess, so instead rewriting, I have created 301 redirects manually. It isn't too much records, about 40 redirects, and I am basically copying URL from Excel table. But how to redirect complete URL on subdomain to main domain:
I want to redirect in this way:
http://m.somesite.com.au/site/somesite/faqs -> 301 http://www.somesite.com.au/faqs/
And of course redirect global subdomain in this way:
http://m.somesite.com.au -> 301 http://www.somesite.com.au
what actually works. What am I doing wrong?
For example:
This redirects work
redirect 301 /about-us/go-social/ http://www.somesite.com/about-us/
redirect 301 /about-us/team/John/ http://www.somesite.com/about-us/
And whole bunch of similar redirects, and then about then redirects like this, which don't work:
This redirects don't work
redirect 301 http://m.somesite.com.au/site/somesite/faqs http://www.somesite.com.au/faqs/
Can I redirect complete URL in that way, or is there another solution? Still this isn't working, using RewriteCond:
# Single URL
RewriteCond %{HTTP_HOST} ^m\.somesite\.com\.au$ [NC]
RewriteRule ^site/somesite/faqs/?$ http://www.somesite.com.au/faqs/
# Global subdomain redirect
RewriteCond %{HTTP_HOST} ^m\.somesite\.com\.au [NC]
RewriteRule ^(.*) http://www.somesite.com.au/$1 [NC,L,R=301]
.htaccess file:
# 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
# 301 Redirects
redirect 301 /about-us/go-social/ http://www.somesite.com.au/about-us/
redirect 301 /about-us/rider-profiles/Alex/ http://www.somesite.com.au/about-us/
{...}
# redirect http://m.somesite.com.au/site/somesite/faqs to http://www.somesite.com.au/faqs/
# m.somesite.com.au redirects
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^m\.somesite\.com.au$ [NC]
RewriteRule ^site/somesite/faqs/?$ http://www.somesite.com.au/faqs/ [NC,L,R=301]
# Global subdomain redirect
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^m\.somesite\.com.au [NC]
RewriteRule ^(.*) http://www.somesite.com.au/$1 [R=301]
.com
,.com.au
)? Is it really all the same domain? Just with multiple subdomains? Are the subdomains and main domain hosted at the same place? In a subdirectory? Or completely different host? Where exactly is the .htaccess file?