dreamwest Posted April 17, 2011 Share Posted April 17, 2011 ive set up subdomain rewrite as follows, the only problem is none of the other rewites work on the subdomian Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^site.com [NC] RewriteRule (.*)$ http://www.site.com/$1 [L,R=301] RewriteCond %{HTTP_HOST} !^www\.site.com RewriteCond %{HTTP_HOST} ([^.]+)\.site.com RewriteRule ^(.*)$ /home/site.com/index.php?lang=%1 # Main pages RewriteRule ^$ index.php RewriteRule ^view=(.*) index.php RewriteRule ^sort=(.*) index.php RewriteRule ^page=(.*) index.php So if i go to http://www.site.com/view=1 it works but if i go to http://es.site.com/view=1 it only shows the main page aka http://es.site.com Quote Link to comment https://forums.phpfreaks.com/topic/233931-subdomains/ Share on other sites More sharing options...
requinix Posted April 17, 2011 Share Posted April 17, 2011 What does the code that handles the whole view= thing look like? Quote Link to comment https://forums.phpfreaks.com/topic/233931-subdomains/#findComment-1202536 Share on other sites More sharing options...
dreamwest Posted April 17, 2011 Author Share Posted April 17, 2011 Ignore my last code this is what i have Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^site.com [NC] RewriteRule (.*)$ http://www.site.com/$1 [L,R=301] RewriteCond %{HTTP_HOST} !^www\.site.com RewriteCond %{HTTP_HOST} ([^.]+)\.site.com RewriteRule ^(.*)$ index.php?lang=%1 # Main pages RewriteRule ^view/(.*)/(.*) index.php?nav=play&id=$1&t=$2 [L,QSA] Quote Link to comment https://forums.phpfreaks.com/topic/233931-subdomains/#findComment-1202659 Share on other sites More sharing options...
requinix Posted April 17, 2011 Share Posted April 17, 2011 When you add the ?lang=, you're changing the URL to be index.php. It's not /view/whatever anymore, so that last RewriteRule won't match. Try RewriteCond %{HTTP_HOST} !^www\.site.com RewriteCond %{HTTP_HOST} ([^.]+)\.site.com RewriteRule ^(.*)$ $1?lang=%1 [QSA] Quote Link to comment https://forums.phpfreaks.com/topic/233931-subdomains/#findComment-1202752 Share on other sites More sharing options...
dreamwest Posted April 18, 2011 Author Share Posted April 18, 2011 It works. But its also taking the first $1 from each rewrite Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^site.com [NC] RewriteRule (.*)$ http://www.site.com/$1 [L,R=301] RewriteCond %{HTTP_HOST} !^www\.site.com RewriteCond %{HTTP_HOST} ^(ja|es|it|ar|pt|fr|de|hi|cn)\.site.com RewriteRule ^(.*)$ $1?lang=%1 [QSA] RewriteRule ^play/(.*)/(.*) index.php?nav=play&id=$1&t=$2 [L,QSA] So: http://ja.site.com/play/34/fun The id comes back as "ja" but it should be "34" Quote Link to comment https://forums.phpfreaks.com/topic/233931-subdomains/#findComment-1202772 Share on other sites More sharing options...
dreamwest Posted April 18, 2011 Author Share Posted April 18, 2011 *edit actually the id is coming back as 34//34 Quote Link to comment https://forums.phpfreaks.com/topic/233931-subdomains/#findComment-1202780 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.