mikeylong7
mikeylong7

Reputation: 1

.htaccess 301 redirect for specific mobile url to desktop url

I have not been able to find any scripts for specifically what I'm trying to do. I currently have a mobile site hosted on a third party (dudamobile). m.example.com

I have designed a new responsive version of the original desktop site and do not need the third party hosting anymore. I need to 301 redirect all of my current mobile url's to the desktop version url and upload to the .htaccess in new m. subdomain.

My mobile urls' are indexed as:

http://m.example.com/?url=http%3A%2F%2Fwww.example.com%2Fpage1.cfm#2805

and would need to redirect to:

http://www.example.com/page1

Fyi... The number at the end changes for each mobile url.

I need to redirect about 10 url's. Any ideas how to accomplish?

Upvotes: 0

Views: 413

Answers (1)

Martin T.
Martin T.

Reputation: 11

In fact, I came to this site, because I needed an answer to the same question. I didnt find any help here, but found out myself. Its an old post, but maybe someone else can use this:

In htaccess:

RewriteEngine On

RewriteCond %{HTTP_HOST} m.yoursite.com [NC]

RewriteRule (.*) http://yoursite.com/ [R=301,L]

That worked for me :) and it also redirect subpages, so no need for doing it for every URL.

Regards, Martin

Upvotes: 1

Related Questions