Jump to content

subdomains


dreamwest

Recommended Posts

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

 

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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"

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.