- This topic is empty.
-
AuthorPosts
-
July 13, 2013 at 11:18 am #46373EpyParticipant
Hello all !
I’d like some help for something that bugs me a littleI’m trying to redirect my visitors from:
http://example.com/ to http://example.com/www AND displaying http://www.example.com in address bar
I already have a .htaccess redirection from:
http://example.com to http://www.example.com
but it also let visitors go to:
http://mysubdomain.example.com 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} ^domaine.net$
RewriteRule ^(.*) http://www.domaine.net/$1 [QSA,L,R=301]Someone has a clue ?
Thanks !
July 13, 2013 at 3:32 pm #142689georgearnallParticipantI am not sure this is possible… Why are you trying to redirect visitors to http://example.com/www ? Wouldn’t it be easier to move the contents of this folder to the root directory ?
July 13, 2013 at 5:10 pm #142696EpyParticipantBecause 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 http://example.com to http://example.com/www with a php file in root
and have it rewrited to http://www.example.com with htaccess file ?Thank you
July 14, 2013 at 4:51 am #142728EpyParticipantThat’s what I was thinking, redirecting to /www and rewriting url (but could it be a problem for search engines ?)
July 14, 2013 at 1:07 pm #142773EpyParticipantI 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) ?
July 15, 2013 at 3:12 pm #142993EpyParticipantThank you !
I’ll try soonJuly 31, 2013 at 3:59 pm #145308EpyParticipantHello
Sadly this doesn’t work, actually the redirections are OK as they were before: I keep the subdomains redirections (projets.domain.com 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 -
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.