phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Redirect invisible

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
::  
Author Message
junter



Joined: 29 Dec 2007
Posts: 2

Redirect invisiblePosted: 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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Redirect invisiblePosted: 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
Visit poster's website
junter



Joined: 29 Dec 2007
Posts: 2

Redirect invisiblePosted: 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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Redirect invisiblePosted: Sun Dec 30, 2007 10:17 am    Post subject: Re: Redirect invisible

You can add an .htaccess file with :
Code:
RewriteEngine Off


in it, in all the dir where you do not want mod_rewrite to be active (image dirs and so on).

++

_________________
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
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » Apache mod Rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: