301 redirect is not working in .htaccess file

mike12345

New Member
Can anyone tell me why the below 301 redirect is not working. I want to have it so any web pages with a .php at the end or http at the beginning get redirected to the version that would be the format of www.mysite.com. (not really the name of my website) All off the code I have in my htaccess file is below so could someone tell me what I am doing wrong?



# BEGIN WordPress

<IfModule mod_rewrite.c>
ReWriteBase /
Options +FollowSymlinks
Options -MultiViews

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.mywebsite.com/ [R=301,L]

RewriteCond %{HTTP_HOST} ^mywebsite.com
RewriteRule (.*) http://www.mywebsite.com/$1 [R=301,L]
</IfModule>
# END WordPress
 

chrishirst

Well-Known Member
Staff member
You do know that http:// IS the protocol for delivering website documents. So whether you want www.hostname or just hostname it HAS to be http://

the homepage redirects to http://www.mysite.com/ regardless of which version you put into the address bar (eg mysite.com or www.mysite.com).
And the problem there is??????


The code you have posted is for WordPress where all functions are handled BY the one document. (index.php)
 
Top