Magento SEO /index.php re writes
Step 1) Make a copy of your current .htacess file
that is in your website root and put this into the /downloader/
directory. This is needed else Magento connect will have issues when
you try and install new extensions.
Step 2) Open the .htaccess file found in your
website root and look for this line:
Options +FollowSymLinks
RewriteEngine on
RewriteEngine on
Below this add:
RewriteCond %{THE_REQUEST}
^.*/index.php
RewriteRule ^(.*)index.php$ http://www.your-domain-name.com/$1 [R=301,L]
Redirect 301 /index.html http://www.your-domain-name.com/
RewriteRule ^(.*)index.php$ http://www.your-domain-name.com/$1 [R=301,L]
Redirect 301 /index.html http://www.your-domain-name.com/
Replacing 'your-domain-name.com' with your real
domain.
Step 3) Save and test the front end, back end and
Magento connect works as expected, If not just remove these changes
and re save the file.
Step 4) If its all working as expected you can now
head back to http://www.ragepank.com/redirect-check/ and
re check your results.
Redirecting index.php to root using .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.domain.com/$1 [R=301,L]
Removing the index.php from your URL completely
If you would prefer to remove all reference of the
index.php in your URL's there are two things you can do.
- Use Web Server Rewrites
Each page in a Magento website is generated
starting with the same main PHP script. This file is called index.php
and normally resides in the root folder of the website. In order to
run this script for each page, each Magento URL typically looks like
this:
http://www.domain.com/magento/index.php/storeview/url-identifier
Using a technique called web server rewrites,
Magento can hide the file name portion of the URL, making the URL
look like this:
http://www.domain.com/magento/storeview/url-identifier
To hide the �index.php� part of the URL is
common practice in most PHP-based content management systems. It has
no measureable effect on the usability or performance of your website
and will not affect your website�s ranking in the search engines.
go to Magento Admin >> System >>
Configuration >>Web >> Secure:
Use secure URL Front end: YES
Use secure URL Front end: YES
Now go to your magento site root folder and find
the .htaccess file.
In this file find:
#RewriteBase /magento
* Note: unquote this line by removing the "#"
and rename magento to your magento's root directory OR if your
magento is placed in your WWW or public_html directory, then just
make it look like this below:
RewriteBase /
Another way you can help create better SEO is to
add the following lines into your .htaccess file.
Around line 144 you will see the following:
If you would prefer to remove all reference of the
index.php in your URL's there are two things you can do.
- Use Web Server Rewrites
Each page in a Magento website is generated
starting with the same main PHP script. This file is called index.php
and normally resides in the root folder of the website. In order to
run this script for each page, each Magento URL typically looks like
this:
http://www.domain.com/magento/index.php/storeview/url-identifier
Using a technique called web server rewrites,
Magento can hide the file name portion of the URL, making the URL
look like this:
http://www.domain.com/magento/storeview/url-identifier
To hide the �index.php� part of the URL is
common practice in most PHP-based content management systems. It has
no measureable effect on the usability or performance of your website
and will not affect your website�s ranking in the search engines.
go to Magento Admin >> System >>
Configuration >>Web >> Secure:
Use secure URL Front end: YES
Use secure URL Front end: YES
Now go to your magento site root folder and find
the .htaccess file.
In this file find:
#RewriteBase /magento
* Note: unquote this line by removing the "#"
and rename magento to your magento's root directory OR if your
magento is placed in your WWW or public_html directory, then just
make it look like this below:
RewriteBase /
Another way you can help create better SEO is to
add the following lines into your .htaccess file.
Around line 144 you will see the following:
############################################
## rewrite everything else to index.php
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
############################################
## rewrite everything else to index.php
## rewrite everything else to index.php
RewriteRule .* index.php [L]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.mydomain.com/$1 [R=301,L]
RewriteCond %{http_host} ^www.mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,NC]
RewriteRule ^index.php/(.*) $1 [R=301,QSA,L]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.mydomain.com/$1 [R=301,L]
RewriteCond %{http_host} ^www.mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,NC]
RewriteRule ^index.php/(.*) $1 [R=301,QSA,L]
</IfModule>
############################################
This 301 redirect all /index.php/ to /
and preventing all use of the index.php
Redirect to WWW and without wwww
The solution is simple. Go to your .htaccess fine
and find the line that says
RewriteEngine
on
If you want to have www part:
RewriteEngine on
RewriteCond %{HTTP_HOST}
!^www\.yourdomain\.com$ [NC]
RewriteRule
^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
If you don’t want to have www part:
RewriteEngine on
RewriteCond %{HTTP_HOST}
!^yourdomain\.com$ [NC]
RewriteRule
^(.*)$ http://yourdomain.com/$1 [R=301,L]
Btw. This is applicable and good to be set to
every site, not just Magento ones.
No comments:
Post a Comment