subdomain problem

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 21
Joined: 12 Apr 2013, 08:19

subdomain problem

12 Apr 2013, 08:56

Hi.
I got a problem to rewrite my subdomain.
I got a site www.mydomain.com and I already did the following rule :

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.mydomain.com
RewriteCond %{HTTP_HOST} ^([^.]+).mydomain.com
RewriteRule ^$ /dev/index.php?sd=%1 [NC]


This rule is redirecting all subdomain "mysub.mydomain.com" to "/dev/index.php?sd=mysub" execepted for the sub "www."
This works fine.
But, I got a problem to add a new var in the url.
I would like to do the following :

"http://mysub.mydomain.com/mypage/" to "/dev/index.php?sd=mysub&page=mypage".

I tested different things with no success.
Can you help ?

Thanks :-)

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: subdomain problem

12 Apr 2013, 21:31

Hello,

Lets try adding the following rule to the existing:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+).mydomain\.com
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/]+)/?$ /dev/index.php?sd=%1&page=$1 [NC]


Regards
Andrew

User avatar
Posts: 21
Joined: 12 Apr 2013, 08:19

Re: subdomain problem

13 Apr 2013, 13:45

Hi Andrew!

That's brillant! This is working perfectly! You are my superman!!
Thanks a lot.

Cheers,

Yull

User avatar
Posts: 21
Joined: 12 Apr 2013, 08:19

Re: subdomain problem

13 May 2013, 15:38

Hi Andrew Again! Sorry to bugger you.
I got a prob. I have now to add a new parameter to my url rewrite:

RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteCond %{HTTP_HOST} ^([^.]+).mydomain\.com
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/]+)/?$ /dev/index.php?sd=%1&page=$1 [NC]

I want to add &mypg=... like this

RewriteRule ^([^/]+)/?$/...mynewparam.../ /dev/index.php?sd=%1&pg=$1&mypg=$2 [NC]

Thanks in advance.

Cheers,

Yull

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 16 guests