new param in subdomain rewrite
10 posts
• Page 1 of 1
new param in subdomain rewrite
Hi Again! Sorry to bugger you.
I got a prob. I have now to add a new parameter to my url rewrite (subdomain):
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
I got a prob. I have now to add a new parameter to my url rewrite (subdomain):
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
Re: new param in subdomain rewrite
Please try to fix your rule like this:
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&mypg=$2 [NC]
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&mypg=$2 [NC]
Re: new param in subdomain rewrite
Sorry Anton,
I got a new problem.
I can't make both rules work together:
---------------------------------------------
1) RewriteRule ^([^/]+)/?$ /dev/index.php?sd=%1&pg=$1 [NC]
2) RewriteRule ^([^/]+)/([^/]+)/?$ /dev/index.php?sd=%1&pg=$1&mypg=$2 [NC]
My website url base is the first 1) and I need sometime to add a new param like "mypg" but the url base must work all the time.
Find below the url format:
---------------------------------------------
A) http://mysubdomain.mydomain.com/pg/ (my url base)
B) http://mysubdomain.mydomain.com/pg/mypg/ (new param).
If I use the the second 2) rule alone, I have to use second B) format for the whole website and I can't now change my url base.
I have to continue with it.
Any solution?
Cheers,
Yull
I got a new problem.
I can't make both rules work together:
---------------------------------------------
1) RewriteRule ^([^/]+)/?$ /dev/index.php?sd=%1&pg=$1 [NC]
2) RewriteRule ^([^/]+)/([^/]+)/?$ /dev/index.php?sd=%1&pg=$1&mypg=$2 [NC]
My website url base is the first 1) and I need sometime to add a new param like "mypg" but the url base must work all the time.
Find below the url format:
---------------------------------------------
A) http://mysubdomain.mydomain.com/pg/ (my url base)
B) http://mysubdomain.mydomain.com/pg/mypg/ (new param).
If I use the the second 2) rule alone, I have to use second B) format for the whole website and I can't now change my url base.
I have to continue with it.
Any solution?
Cheers,
Yull
Re: new param in subdomain rewrite
Please try to fix the rules like this:
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&pg=$1 [NC,L]
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&pg=$1&mypg=$2 [NC,L]
Note that the RewriteConds affect only ONE RewriteRule directive following them.
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&pg=$1 [NC,L]
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&pg=$1&mypg=$2 [NC,L]
Note that the RewriteConds affect only ONE RewriteRule directive following them.
Re: new param in subdomain rewrite
Hi Anton,
Still got a prob!
When I run both togheter, it's taking the data request like below:
http://mysubdomain.mydomain.com/dev/index.php?sd=monseminaire&pg=dev&mypg=index.php
It gives to pg= the dev folder and to mypg= the webpage instead of getting value of
http://mysubdomain.mydomain.com/pg/mypg/ like http://mysubdomain.mydomain.com/1/A/
generating the following url example :
http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1&mypg=A
Weird!
Any solution?
Cheers,
Yull
Still got a prob!
When I run both togheter, it's taking the data request like below:
http://mysubdomain.mydomain.com/dev/index.php?sd=monseminaire&pg=dev&mypg=index.php
It gives to pg= the dev folder and to mypg= the webpage instead of getting value of
http://mysubdomain.mydomain.com/pg/mypg/ like http://mysubdomain.mydomain.com/1/A/
generating the following url example :
http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1&mypg=A
Weird!
Any solution?
Cheers,
Yull
Re: new param in subdomain rewrite
Let me clarify:
you want to request http://mysubdomain.mydomain.com/1/A/ and want it to show the content of http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1&mypg=A, right?
Does it not happen?
please enable logging in httpd.conf by putting
RewriteLogLevel 9
and provide rewrite.log records for the test request. rewrite.log is located in ISAPI_Rewrite installation folder.
you want to request http://mysubdomain.mydomain.com/1/A/ and want it to show the content of http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1&mypg=A, right?
Does it not happen?
please enable logging in httpd.conf by putting
RewriteLogLevel 9
and provide rewrite.log records for the test request. rewrite.log is located in ISAPI_Rewrite installation folder.
Re: new param in subdomain rewrite
Yep, this is exactly what I want!
Making both rules and examples working together :
http://mysubdomain.mydomain.com/1/A/ showing content of
http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1&mypg=A
and
http://mysubdomain.mydomain.com/1/ showing content of
http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1
Thanks
Making both rules and examples working together :
http://mysubdomain.mydomain.com/1/A/ showing content of
http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1&mypg=A
and
http://mysubdomain.mydomain.com/1/ showing content of
http://mysubdomain.mydomain.com/dev/index.php?sd=mysubdomain&pg=1
Thanks
Re: new param in subdomain rewrite
The rules you currently have should do what you want just fine. One small fix:
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&pg=$1 [NC,L]
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&pg=$1&mypg=$2 [NC,L]
Also please make sure you don't have some other rules in other locations.
And if it still doesn't work, please enable logging in httpd.conf by putting
RewriteLogLevel 9
and provide rewrite.log records for the non-working request.
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&pg=$1 [NC,L]
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&pg=$1&mypg=$2 [NC,L]
Also please make sure you don't have some other rules in other locations.
And if it still doesn't work, please enable logging in httpd.conf by putting
RewriteLogLevel 9
and provide rewrite.log records for the non-working request.
Re: new param in subdomain rewrite
Hi Anton!
You small fix works and solves the problem!!
Thanks a lot! ^^
Cheers,
Yull
You small fix works and solves the problem!!
Thanks a lot! ^^
Cheers,
Yull
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests