?
Solved

.htaccess simple redirection

Posted on 2011-10-06
2
Medium Priority
?
255 Views
Last Modified: 2012-05-12
Hi experts,

Here is a simple .htaccess question

presidentevil

My goal is to redirect presidentevil.fr to www.presidentevil.fr

I use that:

SetEnv PHP_VER 5
RewriteEngine on
Rewritecond %{HTTP_HOST} ^presidentevil.fr$
Rewriterule ^(.*) http://www.presidentevil.fr/$1 [QSA,L,R=301]

It seems the htaccess is active because If I remove
SetEnv PHP_VER 5
I got php errors.

Troubles is : when I type in presidentevil.fr it does not redirect to www. !
What am I doing wrong ?


regards

0
Comment
Question by:yarekGmail
2 Comments
 
LVL 14

Expert Comment

by:quizwedge
ID: 36923216
I'm no expert at .htaccess, but check out the generator at http://www.htaccessredirect.net/index.php Looks like the syntax is a little off.

For a non-generator based solution, check out http://kb.mediatemple.net/questions/85/Using+.htaccess+rewrite+rules#gs/add-www-or-https
0
 
LVL 7

Accepted Solution

by:
boon86 earned 2000 total points
ID: 36923816
try

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^presidentevil.fr [NC] 
RewriteRule ^(.*)$ http://www.presidentevil.fr/$1 [L,R=301] 

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 16 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question