Help redirecting a page

udt89

Regular Member
Joined
Dec 22, 2009
Messages
380
Reaction score
104
I have a mobile site that has a redirect to m.sitename.com for users when they are on a detected mobile device.

The problem I have is this. Their location in google is found at www.sitename.com/locations/location-name/

But if you click that link on your phone it brings you to m.sitename.com/locations/location-name which doesnt exist.

How can i fix this? I tried editing the htaccess file in the main directory with no luck as well as the htaccess in the "m" folder.

And I guess how can i make all the main site pages redirect to the correct m.sitename.com versions
 
Last edited:
anyone? really could use the help
 
Instead of "m.sitename.com/locations/location-name" what are mobile users supposed to be redirected to?
 
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^location.*$ http://m.sitename.com/ [R=301,L]

That should rewrite your urls from http://m.sitename.com/locations/ to http://m.sitename.com/, not 100% that's what you want or that's the best way but you need to give us more info.
 
I want m.sitename.com/locations/location-name to go to m.sitename.com/locationname.html for each location
 
Do you have multiple "locations" folders? is the "locationname.html" name file must be the same as the "location-name" in the desktop site?
 
no there is only one locations folder for the desktop site. There isnt a folder for the mobile site.

the locationname.html is a mobile page in html (obviously) but the desktop page location-name is a wordpress page.

Whats happening is, in Google, if you click a location that is listed under the listing in the results it is sending you to the desktop page but bc you are on your mobile device it is rewriting to m.sitename.com
 
I do appreciate the help. What you posted is close but I think maybe I need to add each specific location page and the corresponding html page in the M directory?
 
Did that info help any?
 
i dont want to redirect a domain....
 
still looking for some help
 
still looking for a solution to this
 
Sign up for cloudflare for free. They have custom redirect for mobile (google how to do it)
 
Back
Top