Based very specifically on the information that you provided in your question, all you need to do is create a file called .htaccess
in the doc root (web / httpdocs / www folder) of mobile.example.com
(inside your "mobile" directory) and put in the code below. Be sure to add the most relevant version that best fits your circumstances, as indicated below:
1. Preferred version of your domain's URL is "non-www"
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index.html(.*)$ http://example.com/index.html$1 [R=301,NC]
2. Preferred version of your domain's URL is the "www" version
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index.html(.*)$ http://www.example.com/index.html$1 [R=301,NC]
As for redirecting individual pages to other individual pages, as long as the URLs are identical, and the only difference is the mobile subdomain, then you should be good to go. I have not tested this, please provide feedback!
On the other hand, if URIs for each individual directory (i.e. /directory/
) or page (i.e. /page.html
) on your old mobile version are different than the non-mobile version, all that you would need to..
Page to Page Redirect from subdomain:
Redirect 301 "/old-page.html" "http://www.example.com/new-page.html"
Remember, this is all taking place on the .htaccess
file you created within the mobile folder.