The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Htaccess redirection

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #46373

    Hello all !
    I’d like some help for something that bugs me a little

    I’m trying to redirect my visitors from: to AND displaying in address bar

    I already have a .htaccess redirection from: to
    but it also let visitors go to: without redirecting them
    (If subdomain doesn’t exists I get a “page doesn’t exists” error from browser)

    I only have a shared hosting so I used the webinterface to create and manage subdomains redirections (it works well). I don’t have access to other related parameters. I have to use htaccess

    Here it is:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^$
    RewriteRule ^(.*)$1 [QSA,L,R=301]

    Someone has a clue ?

    Thanks !


    I am not sure this is possible… Why are you trying to redirect visitors to ? Wouldn’t it be easier to move the contents of this folder to the root directory ?


    Because my CMS is installed in this www directory.
    I think it would be really messy to install its index.php and all other directories in root :/

    May I redirect to with a php file in root
    and have it rewrited to with htaccess file ?

    Thank you


    That’s what I was thinking, redirecting to /www and rewriting url (but could it be a problem for search engines ?)


    I was thinking about SEO while reading your answer, I read about Google recommandations, to avoid “punishment” in search answers and they say to choose between with www and without, but if you say I can use this trick why not :)

    The problem is I can’t redirect EVERYTHING to www/ because I have subdomains, they will redirect to /www too

    The RewriteBase should be the full path to where the htaccess file is, or to the root directory of my website (root directory of the CMS in this case) ?


    Thank you !
    I’ll try soon



    Sadly this doesn’t work, actually the redirections are OK as they were before: I keep the subdomains redirections ( still goes to /projets, etc.) and the “no-www” to “with-www”

    But my visitors won’t go to the /www directory automatically
    I have to find a good way to do that

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Other’ is closed to new topics and replies.