You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Cristian Bichis <cr...@gmx.net> on 2005/11/04 12:54:43 UTC

[users@httpd] mod_rewrite on subdomains

Hello!

I have one problem who gives me headache.


I have one website, let say:    site.com

I have one subdomain:  subdomain.site.com

I will do into browser two types of requests:

1. http://subdomain.site.com        the url should stay as is it (no
redirection) but the internal processing should load file index.php from
site root (URL:  www.site.com/index.php); so in file paths terms should
load index.php from the parent of subdomain folder

2. http://subdomain.site.com/parameter         the url should stay as is
it (no redirection) but the internal processing should load file
index.php?p=parameter from site root (URL:  www.site.com/index.php); so
in file paths terms should load index.php from the parent of subdomain
folder


How it should look main .htaccess then ? I mean RewriteRule, RewriteCond
aso...

Best regards,
Cristian Bichis


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on subdomains

Posted by Cristian Bichis <cr...@gmx.net>.
Hello,

The website root is:

/home/site/domains/site.com/public_html

Cristian Bichis

>I think this is impossible to answer without knowing what the
>DocumentRoot of each of the two vhosts is.  Please provide what your
>file structure looks like,
>
>
>On 11/4/05, Cristian Bichis <cr...@gmx.net> wrote:
>  
>
>>Hello!
>>
>>I have one problem who gives me headache.
>>
>>
>>I have one website, let say:    site.com
>>
>>I have one subdomain:  subdomain.site.com
>>
>>I will do into browser two types of requests:
>>
>>1. http://subdomain.site.com        the url should stay as is it (no
>>redirection) but the internal processing should load file index.php from
>>site root (URL:  www.site.com/index.php); so in file paths terms should
>>load index.php from the parent of subdomain folder
>>
>>2. http://subdomain.site.com/parameter         the url should stay as is
>>it (no redirection) but the internal processing should load file
>>index.php?p=parameter from site root (URL:  www.site.com/index.php); so
>>in file paths terms should load index.php from the parent of subdomain
>>folder
>>
>>
>>How it should look main .htaccess then ? I mean RewriteRule, RewriteCond
>>aso...
>>
>>Best regards,
>>Cristian Bichis
>>
>>
>>---------------------------------------------------------------------
>>The official User-To-User support forum of the Apache HTTP Server Project.
>>See <URL:http://httpd.apache.org/userslist.html> for more info.
>>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
>  
>


Re: [users@httpd] mod_rewrite on subdomains

Posted by Sean Brown <se...@gmail.com>.
I think this is impossible to answer without knowing what the
DocumentRoot of each of the two vhosts is.  Please provide what your
file structure looks like,


On 11/4/05, Cristian Bichis <cr...@gmx.net> wrote:
> Hello!
>
> I have one problem who gives me headache.
>
>
> I have one website, let say:    site.com
>
> I have one subdomain:  subdomain.site.com
>
> I will do into browser two types of requests:
>
> 1. http://subdomain.site.com        the url should stay as is it (no
> redirection) but the internal processing should load file index.php from
> site root (URL:  www.site.com/index.php); so in file paths terms should
> load index.php from the parent of subdomain folder
>
> 2. http://subdomain.site.com/parameter         the url should stay as is
> it (no redirection) but the internal processing should load file
> index.php?p=parameter from site root (URL:  www.site.com/index.php); so
> in file paths terms should load index.php from the parent of subdomain
> folder
>
>
> How it should look main .htaccess then ? I mean RewriteRule, RewriteCond
> aso...
>
> Best regards,
> Cristian Bichis
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on subdomains

Posted by Joshua Slive <js...@gmail.com>.
On 11/4/05, Cristian Bichis <cr...@gmx.net> wrote:
> Hello,
>
> >Why don't you say what you're trying instead.
> >
> All my pages requests must go to one unique file: index.php into website
> root.
>
> I need a subdomain, and all requests for pages from subdomain must go to
> index.php into website root not subdomain folder.

I meant that you should show us the configuration you are using.

>
> >And you absolutely must
> >use the RewriteLog to debug mod_rewrite problems.  And mod_rewrite
> >problems are usually simpler to bug when you put your rules in
> >httpd.conf rather than .htaccess.
> >
> >
> I am hosting my ws on a reseller account. Can't have access to rewrite log.

Then all hope is lost ;-)

Seriously, you should setup apache on a local computer and test it
there before deploying to your host.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on subdomains

Posted by Cristian Bichis <cr...@gmx.net>.
Hello,

>Why don't you say what you're trying instead.  
>
All my pages requests must go to one unique file: index.php into website 
root.

I need a subdomain, and all requests for pages from subdomain must go to 
index.php into website root not subdomain folder.

>And you absolutely must
>use the RewriteLog to debug mod_rewrite problems.  And mod_rewrite
>problems are usually simpler to bug when you put your rules in
>httpd.conf rather than .htaccess.
>  
>
I am hosting my ws on a reseller account. Can't have access to rewrite log.

Cristian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on subdomains

Posted by Joshua Slive <js...@gmail.com>.
On 11/4/05, Cristian Bichis <cr...@gmx.net> wrote:

>  Not working. Maybe i am wrong with something. Could u give me a sample in
> this case ?

Why don't you say what you're trying instead.  And you absolutely must
use the RewriteLog to debug mod_rewrite problems.  And mod_rewrite
problems are usually simpler to bug when you put your rules in
httpd.conf rather than .htaccess.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on subdomains

Posted by Cristian Bichis <cr...@gmx.net>.
>> 1. http://subdomain.site.com the url should stay as is it (no
>>redirection) but the internal processing should load file index.php from
>>site root (URL: www.site.com/index.php); so in file paths terms should
>>load index.php from the parent of subdomain folder
>>
>>2. http://subdomain.site.com/parameter the url should stay
>>as is
>>it (no redirection) but the internal processing should load file
>>index.php?p=parameter from site root (URL: www.site.com/index.php); so
>>in file paths terms should load index.php from the parent of subdomain
>>folder
>>
>> RewriteRule (.*) index.php?p=$1
>>
>>I don't really see what is complicated here.
>>
>> With this rule you are loading index.php from  http://subdomain.site.com
>>not from http://www.site.com.
>>
>> I need to load index.php from root not from subdomani folder.
>>    
>>
>
>So use an absolute file-system path to index.php.
>  
>

Not working. Maybe i am wrong with something. Could u give me a sample 
in this case ?

Thanks,
Cristian

Re: [users@httpd] mod_rewrite on subdomains

Posted by Joshua Slive <js...@gmail.com>.
On 11/4/05, Cristian Bichis <cr...@gmx.net> wrote:
>
>
>
>  1. http://subdomain.site.com the url should stay as is it (no
> redirection) but the internal processing should load file index.php from
> site root (URL: www.site.com/index.php); so in file paths terms should
> load index.php from the parent of subdomain folder
>
> 2. http://subdomain.site.com/parameter the url should stay
> as is
> it (no redirection) but the internal processing should load file
> index.php?p=parameter from site root (URL: www.site.com/index.php); so
> in file paths terms should load index.php from the parent of subdomain
> folder
>
>  RewriteRule (.*) index.php?p=$1
>
> I don't really see what is complicated here.
>
>  With this rule you are loading index.php from  http://subdomain.site.com
> not from http://www.site.com.
>
>  I need to load index.php from root not from subdomani folder.

So use an absolute file-system path to index.php.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on subdomains

Posted by Cristian Bichis <cr...@gmx.net>.
>>1. http://subdomain.site.com        the url should stay as is it (no
>>redirection) but the internal processing should load file index.php from
>>site root (URL:  www.site.com/index.php); so in file paths terms should
>>load index.php from the parent of subdomain folder
>>
>>2. http://subdomain.site.com/parameter         the url should stay as is
>>it (no redirection) but the internal processing should load file
>>index.php?p=parameter from site root (URL:  www.site.com/index.php); so
>>in file paths terms should load index.php from the parent of subdomain
>>folder
>>    
>>
>
>RewriteRule (.*) index.php?p=$1
>
>I don't really see what is complicated here.
>  
>
With this rule you are loading index.php from  
http://subdomain.site.com   not from http://www.site.com.

I need to load index.php from root not from subdomani folder.

Cristian

Re: [users@httpd] mod_rewrite on subdomains

Posted by Joshua Slive <js...@gmail.com>.
On 11/4/05, Cristian Bichis <cr...@gmx.net> wrote:
> 1. http://subdomain.site.com        the url should stay as is it (no
> redirection) but the internal processing should load file index.php from
> site root (URL:  www.site.com/index.php); so in file paths terms should
> load index.php from the parent of subdomain folder
>
> 2. http://subdomain.site.com/parameter         the url should stay as is
> it (no redirection) but the internal processing should load file
> index.php?p=parameter from site root (URL:  www.site.com/index.php); so
> in file paths terms should load index.php from the parent of subdomain
> folder

RewriteRule (.*) index.php?p=$1

I don't really see what is complicated here.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org