Alias and subdomain!
21 posts
• Page 1 of 2 • 1, 2
Alias and subdomain!
Hi there!
I got a prob.
I got my rules that are well working for redirecting and hidding parameters as an alias/subdomain as below:
I need now to redirect any domain name on the alias created.
For sure, I have tested it and 've done the CNAME and I am actually redirected on www. mywebsite.com and not on (%1).mywebsite.com
To be clear, I need (as example) http://www.mydomain.com works as the subdomain created on rules above.
So,
www. mywebsite.com?sd=hello&pg=$1&mypg=$2 works as hello.mywebsite.com and it's fine and I need to redirect any CNAME and also make it work as http://www.mydomain.com.
www. mydomain.com = hello.mywebsite.com = www. mywebsite.com?sd=hello
Both rules (CNAME and Subdomains) has to work together.
Hope you can help.
Cheers,
Yull
I got a prob.
I got my rules that are well working for redirecting and hidding parameters as an alias/subdomain as below:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.mywebsite.com
RewriteCond %{HTTP_HOST} ^([^.]+).mywebsite.com
RewriteRule ^$ /dir/index.php?sd=%1 [NC]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mywebsite\.com
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/.]+)/?$ /dir/index.php?sd=%1&pg=$1 [NC,L]
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mywebsite\.com
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/.]+)/([^/.]+)/?$ /dir/index.php?sd=%1&pg=$1&mypg=$2 [NC,L]
I need now to redirect any domain name on the alias created.
For sure, I have tested it and 've done the CNAME and I am actually redirected on www. mywebsite.com and not on (%1).mywebsite.com
To be clear, I need (as example) http://www.mydomain.com works as the subdomain created on rules above.
So,
www. mywebsite.com?sd=hello&pg=$1&mypg=$2 works as hello.mywebsite.com and it's fine and I need to redirect any CNAME and also make it work as http://www.mydomain.com.
www. mydomain.com = hello.mywebsite.com = www. mywebsite.com?sd=hello
Both rules (CNAME and Subdomains) has to work together.
Hope you can help.
Cheers,
Yull
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
Hello,
My questions would be: how would www.website.com know which SD parameter value to use?
Regards
Andrew
My questions would be: how would www.website.com know which SD parameter value to use?
Regards
Andrew
Re: Alias and subdomain!
Throught the alias SD.mywebsite.com -> www.mywebsite.com/index.php?sd=%1
and this rule already works. I am interested in creating a CNAME with a new domain name redirected on my SD.mywebsite.com.
Actually, when I set the CNAME www.mydomain.com on SD.mywebsite.com, I am redirected on www.mywebsite.com.
Any thought?
Cheers,
Yull
and this rule already works. I am interested in creating a CNAME with a new domain name redirected on my SD.mywebsite.com.
Actually, when I set the CNAME www.mydomain.com on SD.mywebsite.com, I am redirected on www.mywebsite.com.
Any thought?
Cheers,
Yull
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
it'd confusing...
are you asking for the rule that would redirect from http://www.mywebsite.com to sd.mywebsite.com if the original request came from http://www.mydomain.com?
Regards
Andrew
are you asking for the rule that would redirect from http://www.mywebsite.com to sd.mywebsite.com if the original request came from http://www.mydomain.com?
Regards
Andrew
Re: Alias and subdomain!
Hi Andrew,
Sorry to be confused. I am gonna to try to be christal clear.
I have one website http://www.mywebsite.com which offers some website space and subdomains web addresses.
My actual rules work fines. They are creating subdomains like sub.mywebsite.com or mysub.mywebsite.com traducing the alias as the "?sd=%1" parameter.
Now, I just need to be able to use any other domain names that I can redirect on any subdomains.
For example, on client could purchase one domain name and would like to use it instead of its subdomain for web promotion needs... So he would use its own domain name (e.g. www.mydomain.com) and this should work in addition to the subdomain created. To run some test, I already did one CNAME on my DNS server redirecting http://www.mydomain.com on sub.mywebsite.com.
The problem is I am redirected on http://www.mywebsite.com and not on the subdomain sub.mywebsite.com because I guess the htaccess is not matching.
I hope I am understandable.
Thanks to help.
Cheers,
Yull
Sorry to be confused. I am gonna to try to be christal clear.
I have one website http://www.mywebsite.com which offers some website space and subdomains web addresses.
My actual rules work fines. They are creating subdomains like sub.mywebsite.com or mysub.mywebsite.com traducing the alias as the "?sd=%1" parameter.
Now, I just need to be able to use any other domain names that I can redirect on any subdomains.
For example, on client could purchase one domain name and would like to use it instead of its subdomain for web promotion needs... So he would use its own domain name (e.g. www.mydomain.com) and this should work in addition to the subdomain created. To run some test, I already did one CNAME on my DNS server redirecting http://www.mydomain.com on sub.mywebsite.com.
The problem is I am redirected on http://www.mywebsite.com and not on the subdomain sub.mywebsite.com because I guess the htaccess is not matching.
I hope I am understandable.
Thanks to help.
Cheers,
Yull
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
Hello,
Thanks. Now it is clear.
option #1: You create a rule I suggested before
Option #2: You don't play with CNAME, you create a separate website in IIS for this domain name. Don't create any content, but create a simple rule that redirects from www.mydomain.com to subdomain.mywebsite.com
Regards
Andrew
Thanks. Now it is clear.
option #1: You create a rule I suggested before
rule that would redirect from http://www.mywebsite.com to sd.mywebsite.com if the original request came from http://www.mydomain.com?
Option #2: You don't play with CNAME, you create a separate website in IIS for this domain name. Don't create any content, but create a simple rule that redirects from www.mydomain.com to subdomain.mywebsite.com
Regards
Andrew
Re: Alias and subdomain!
Hi Andrew,
I have to choose the option #1 because clients will have to do it by themself.
Do you have any example of rule allowing with transparency (meaning it keeps in the browser the "www.mydomain.com") and use as well the webpages for web promotion.
I am really an ass to write some rules. Can you help?
Cheers,
Yull
I have to choose the option #1 because clients will have to do it by themself.
Do you have any example of rule allowing with transparency (meaning it keeps in the browser the "www.mydomain.com") and use as well the webpages for web promotion.
I am really an ass to write some rules. Can you help?
Cheers,
Yull
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
Hello,
Try to use:
Regards
Andrew
Try to use:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} ^.*mydomain\.com.*$ [NC]
RewriteCond %{HTTP:Host} ^www\.mywebsite\.com$ [NC]
RewriteRule (.*) http://sd.mywebsite.com/$1 [NC,R=301,L]
Regards
Andrew
Re: Alias and subdomain!
Hi Andrew,
I tryed to make it work, but it doesn't. How do i have to insert it and run with my previous code:
with
I tryed to make it work, but it doesn't. How do i have to insert it and run with my previous code:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} ^.*mydomain.com.*$ [NC]
RewriteCond %{HTTP:Host} ^www.mywebsite.com$ [NC]
RewriteRule (.*) http://sd.mywebsite.com/$1 [NC,R=301,L]
with
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.mywebsite.com
RewriteCond %{HTTP_HOST} ^([^.]+).mywebsite.com
RewriteRule ^$ /dir/index.php?sd=%1 [NC]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mywebsite\.com
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/.]+)/?$ /dir/index.php?sd=%1&pg=$1 [NC,L]
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.mywebsite\.com
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/.]+)/([^/.]+)/?$ /dir/index.php?sd=%1&pg=$1&mypg=$2 [NC,L]
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
It doesn't really matter in your case. They shouldn't interfere.
Try to get the rewrite.log to see how the request is being processed. Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Try to get the rewrite.log to see how the request is being processed. Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Re: Alias and subdomain!
Hi Andrew,
It doesn't work. Find below the full log file including both code running (one trying to access http://www.mydomain.com and another working on sd.mywebsite.com)
Thanks to help.
Cheers,
Yull
It doesn't work. Find below the full log file including both code running (one trying to access http://www.mydomain.com and another working on sd.mywebsite.com)
- Code: Select all
[sd.mywebsite.com/sid#64][rid#22759760/initial] (2) init rewrite engine with requested uri /
[sd.mywebsite.com/sid#64][rid#22759760/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[sd.mywebsite.com/sid#64][rid#22759760/initial] (1) Htaccess process request d:\web_server\mywebsite.com\www\.htaccess
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern '^(.*)' to uri ''
[sd.mywebsite.com/sid#64][rid#22759760/initial] (4) RewriteCond: input='sd.mywebsite.com' pattern='^mywebsite.com$' => not-matched
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern '^$' to uri ''
[sd.mywebsite.com/sid#64][rid#22759760/initial] (4) RewriteCond: input='sd.mywebsite.com' pattern='^www.mywebsite.com' => matched
[sd.mywebsite.com/sid#64][rid#22759760/initial] (4) RewriteCond: input='sd.mywebsite.com' pattern='^([^.]+).mywebsite.com' => matched
[sd.mywebsite.com/sid#64][rid#22759760/initial] (1) Rewrite URL to >> /dev/index.asp?sd=sd
[sd.mywebsite.com/sid#64][rid#22759760/initial] (2) rewrite '' -> '/dev/index.asp?sd=sd'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern '^([^/.]+)/?$' to uri 'dev/index.asp'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern '^([^/.]+)/([^/.]+)/?$' to uri 'dev/index.asp'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'we/(.*)/' to uri 'dev/index.asp'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'ws/config/' to uri 'dev/index.asp'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'xdoc/(.*)_(.*)_(.*)_(.*)/' to uri 'dev/index.asp?sd=sd'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'xidv/(.*)_(.*)_(.*)_(.*)/' to uri 'dev/index.asp?sd=sd'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'pg/(.*)_(.*)_(.*)_(.*).asp' to uri 'dev/index.asp?sd=sd'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'ds/(.*)/(.*)/(.*)/' to uri 'dev/index.asp'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern 'xpg/(.*)_(.*)_(.*)/' to uri 'dev/index.asp?sd=sd'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern '^[^?/]*REF/(\d+)' to uri 'dev/index.asp'
[sd.mywebsite.com/sid#64][rid#22759760/initial] (3) applying pattern '.?' to uri 'dev/index.asp'
[www.mydomain.com/sid#64][rid#42918768/initial] (2) init rewrite engine with requested uri /
[www.mydomain.com/sid#64][rid#42918768/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[www.mydomain.com/sid#64][rid#42918768/initial] (1) Htaccess process request d:\web_server\mywebsite.com\www\.htaccess
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern '^(.*)' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (4) RewriteCond: input='www.mydomain.com' pattern='^mywebsite.com$' => not-matched
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern '^$' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (4) RewriteCond: input='www.mydomain.com' pattern='^www.mywebsite.com' => matched
[www.mydomain.com/sid#64][rid#42918768/initial] (4) RewriteCond: input='www.mydomain.com' pattern='^([^.]+).mywebsite.com' => not-matched
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern '^([^/.]+)/?$' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern '^([^/.]+)/([^/.]+)/?$' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'we/(.*)/' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'ws/config/' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'xdoc/(.*)_(.*)_(.*)_(.*)/' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'xidv/(.*)_(.*)_(.*)_(.*)/' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'pg/(.*)_(.*)_(.*)_(.*).asp' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'ds/(.*)/(.*)/(.*)/' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern 'xpg/(.*)_(.*)_(.*)/' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern '^[^?/]*REF/(\d+)' to uri ''
[www.mydomain.com/sid#64][rid#42918768/initial] (3) applying pattern '.?' to uri ''
Thanks to help.
Cheers,
Yull
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
I edited the logs for easier redaing. It doesn't look like any of these requests will ever match our rule. None of them was requesting correct domain.
In the first case
In the second case:
Regards
Andrew
In the first case
- Code: Select all
(4) RewriteCond: input='sd.mywebsite.com' pattern='^mywebsite.com$' => not-matched
In the second case:
- Code: Select all
(4) RewriteCond: input='www.mydomain.com' pattern='^mywebsite.com$' => not-matched
Regards
Andrew
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
Meaning:
a) you didn't capture the right requests.
b) you didn't edit the rules to match the live site
Regards
Andrew
a) you didn't capture the right requests.
b) you didn't edit the rules to match the live site
Regards
Andrew
Re: Alias and subdomain!
Hi Andrew, I think I get what you want.
Can you please delete my logs and rules after reading. I don't want my web addresses are on Internet. Thanks in advance.
Find below :
and original rules :
What could be really great is people, after redirecting their CNAME on their subdomain.web-events.net, are redirected with only one rule for every case. (don't know if this is possible... if not, i will have to edit each rule for each domain name redirected as a CNAME on the sub domain.)
Hope this will help you to find what's wrong.
Thanks again.
Can you please delete my logs and rules after reading. I don't want my web addresses are on Internet. Thanks in advance.
Find below :
- Code: Select all
(2) init rewrite engine with requested uri /
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\web_serveur\something.net\www\.htaccess
(3) applying pattern '^(.*)' to uri ''
(4) RewriteCond: input='myevent.domain.com' pattern='^something.net$' => not-matched
(3) applying pattern '(.*)' to uri ''
(4) RewriteCond: input='' pattern='^.*domain.com.*$' => not-matched
(3) applying pattern '^$' to uri ''
(4) RewriteCond: input='myevent.domain.com' pattern='^www.something.net' => matched
(4) RewriteCond: input='myevent.domain.com' pattern='^([^.]+).something.net' => not-matched
(3) applying pattern '^([^/.]+)/?$' to uri ''
(3) applying pattern '^([^/.]+)/([^/.]+)/?$' to uri ''
(3) applying pattern 'we/(.*)/' to uri ''
(3) applying pattern 'ws/config/' to uri ''
(3) applying pattern 'xdoc/(.*)_(.*)_(.*)_(.*)/' to uri ''
(3) applying pattern 'xidv/(.*)_(.*)_(.*)_(.*)/' to uri ''
(3) applying pattern 'creation_site_internet.asp' to uri ''
(3) applying pattern 'pg/(.*)_(.*)_(.*)_(.*).asp' to uri ''
(3) applying pattern 'ds/(.*)/(.*)/(.*)/' to uri ''
(3) applying pattern 'xpg/(.*)_(.*)_(.*)/' to uri ''
(3) applying pattern '^[^?/]*references_web(\d+)\.asp' to uri ''
(3) applying pattern '^[^?/]*REF/(\d+)' to uri ''
(3) applying pattern '.?' to uri ''
and original rules :
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} ^.*domain.*$ [NC]
RewriteCond %{HTTP:Host} ^www.something.net$ [NC]
RewriteRule (.*) http://myevent.something.net/$1 [NC,R=301,L]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.something.net
RewriteCond %{HTTP_HOST} ^([^.]+).something.net
RewriteRule ^$ /dev/index.asp?sd=%1 [NC]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.something\.net
RewriteCond %{HTTP_HOST} ^([^.]+)\.something\.net
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/.]+)/?$ /dev/index.asp?sd=%1&pg=$1 [NC,L]
RewriteCond %{HTTP_HOST} !^www\.something\.net
RewriteCond %{HTTP_HOST} ^([^.]+)\.something\.net
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule ^([^/.]+)/([^/.]+)/?$ /dev/index.asp?sd=%1&pg=$1&mypg=$2 [NC,L]
What could be really great is people, after redirecting their CNAME on their subdomain.web-events.net, are redirected with only one rule for every case. (don't know if this is possible... if not, i will have to edit each rule for each domain name redirected as a CNAME on the sub domain.)
Hope this will help you to find what's wrong.
Thanks again.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
See, here's the key phrase
The referer is simply empty. Don't know why. It's just empty.
There's a way to debug and see all the details of a request. IT's a tool developed by Microsoft called Fiddler. You can see if there's something with the request or not
Regards
Andrew
- Code: Select all
(4) RewriteCond: input='' pattern='^.*domain.com.*$' => not-matched
The referer is simply empty. Don't know why. It's just empty.
There's a way to debug and see all the details of a request. IT's a tool developed by Microsoft called Fiddler. You can see if there's something with the request or not
Regards
Andrew
Re: Alias and subdomain!
I have checked fiddler and it doesn't seem to work on asp 3.0 (only .net).
I found something in the code:
RewriteCond %{HTTP:Host} ^www.something.net$ [NC]
is the HTTP:Host is normal? Usually it's written HTTP_HOST
Could it be this error that generates the lost of data input?
I found something in the code:
RewriteCond %{HTTP:Host} ^www.something.net$ [NC]
is the HTTP:Host is normal? Usually it's written HTTP_HOST
Could it be this error that generates the lost of data input?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
This variable has several ways to put and should work for both cases. But you can check, but I wouldn't consider this to be a problem.
Please, clarify
Please, clarify
I have checked fiddler and it doesn't seem to work on asp 3.0 (only .net).
Re: Alias and subdomain!
Hi Andrew,
I try to use the fiddler, but no success.
However, I did many tests and found one problem in the second row linked to the first one in the code above:
So I found a way and it matchs when I use:
or
The second rule is much better coz it works for all urls to translate instead of the home page in http_referer case.
The prob is it doesn't keep my original address in the browser and run the website from myevent.something.net instead of www.mydomain.com .
I really want to stay on
Hope this helps.
(PS : can you also replace abc-idea.com by domain.com in the previous posts including this row)
Thanks in advance.
Cheers,
Yull
I try to use the fiddler, but no success.
However, I did many tests and found one problem in the second row linked to the first one in the code above:
- Code: Select all
RewriteCond %{HTTP_REFERER} ^.*mydomain\.com.*$ [NC]
RewriteCond %{HTTP_HOST} ^www\.something\.net [NC]
RewriteRule (.*) http://myevent.something.net/$1 [NC,R=301,L]
So I found a way and it matchs when I use:
- Code: Select all
RewriteCond %{HTTP_REFERER} ^.*mydomain\.com.*$ [NC]
RewriteRule (.*) http://myevent.something.net/$1 [NC,R=301,L]
or
- Code: Select all
RewriteCond %{HTTP_HOST} ^.*mydomain\.com.*$ [NC]
RewriteRule (.*) http://myevent.something.net/$1 [NC,R=301,L]
The second rule is much better coz it works for all urls to translate instead of the home page in http_referer case.
The prob is it doesn't keep my original address in the browser and run the website from myevent.something.net instead of www.mydomain.com .
I really want to stay on
Hope this helps.
(PS : can you also replace abc-idea.com by domain.com in the previous posts including this row)
Thanks in advance.
Cheers,
Yull
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Alias and subdomain!
If you don't want domain name to change, it's called proxying. All you need to do is replace [NC,R=301,L] with [NC,P,L].
Regards
Andrew
Regards
Andrew
21 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 23 guests