Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm trying to set up a mobile redirect for a site with 2 subfolders, and I cannot get both to work at the same time.
This is the structure of the site

www.mysite.com/EN/

www.mysite.com/ES/

This is a bilingual site so each subfolder contains the files corresponding to each language version. Then I was using a 301 redirect, and setting up the index in /EN/ as the main index. Everything was getting redirected to it. I was using

DirectoryIndex index.html
Redirect /index.html http://www.mysite.com/EN/index.html

and several Rewritecond to redirect mysite.com and old urls to the new URL.

It worked fine before I decided to add a mobile version -> m.mysite.com. I used the solution provided in http://stackoverflow.com/questions/3680463/mobile-redirect-using-htaccess, and it redirects my mobile version properly, but now the desktop is both working. Besides, my mobile version must be bilingual as well.


i'll do my best to clarify. My site is bilingual. I've created two subfolders (EN and ES) to hold the contents for each language. My desktop site requires some kind of redirect to find the right index (one of them at least, i decided to set the english language version as the main index) The script I've used was DirectoryIndex index.html Redirect /index.html http://www.mysite.com/EN/index.html

Now, when i added mobile detection redirect (and it does take me to the mobile version on a mobile device), it seems to go to the usual default index on the desktop (www.mysite.com/index.html) which is not my desktop index.

Any suggestions?

share|improve this question
1  
It's not clear what the problem is. When you say "the desktop is both working" do you mean "not working"? –  paulmorriss May 25 '11 at 8:04
add comment

migrated from stackoverflow.com May 25 '11 at 4:49

This question came from our site for professional and enthusiast programmers.

1 Answer

From the link you have provided ..

# Now redirect to the mobile site
RewriteRule ^ http://m.example.org%{REQUEST_URI} [R,L]

If you are using the the L flag, it mean LAST rule to process, so you can have surprises with further rules :-)

You may also want to use other rules for your mobile/desktop version to redirect to the EN subdir by default instead of using the Redirect command. However, i think the problem here is just your rules order in the htaccess combined with the L flag.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.