| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
junter
Joined: 29 Dec 2007 Posts: 2
|
Posted: Sat Dec 29, 2007 1:41 pm Post subject: Redirect invisible |
|
|
Hello,
I'm trying this:
any-user.mysite.com/any-page -> mysite.com/script.php?user=any-user&page=any-page
It works but not in an invisible way. I got wildcards enabled and this is what i have by now:
| Code: | Options +FollowSymLinks
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^(www\.)?mysite\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/script.php?c=$1 [R,L] |
It does the redirection but there's a URL change in the browser, I would like to keep the cool URL -http://any-user.mysite.com/any-page so the user doesn't notice script.php is there. |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Sat Dec 29, 2007 2:17 pm Post subject: Re: Redirect invisible |
|
|
Have you tried without the R flag ?
| Code: | | RewriteRule ^(.*)$ http://mysite.com/script.php?c=$1 [QSA,L] |
You do not really need to capture the sud-domain name in the .htaccess since you can do it within your php script for the same result.
vhost-alias Apache module can as well be handy for such set up, if you really want your users to use separate dirs in your server :
| Code: | <VirtualHost *>
ServerName example.com
ServerAlias *.example.com
VirtualDocumentRoot /var/www/$1
</VirtualHost> |
in the VHOST.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
junter
Joined: 29 Dec 2007 Posts: 2
|
Posted: Sat Dec 29, 2007 6:51 pm Post subject: Re: Redirect invisible |
|
|
Thanks a lot for your answer.
It's working now but it's redirecting some static subdomains that must no be redirected to the script, like images in images/mysite.com or css folder.
Can I tell htaccess to don't redirect that folders? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |