Thursday, December 22, 2016

joomla 301 redirection from with index.php to without URLs

This can be done using .htaccess file. Open it and add the following code

RewriteEngine On

########## Begin - 301 Redirect

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|home)\.html?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|home)\.html?$ http://www.yourdomain.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.yourdomain.com/$1 [R=301,L]

#RedirectMatch 301 ^/index.php/(.*)$ http://www.yourdomain.com/$1

RewriteCond %{REQUEST_URI} ^/index\.php/
RewriteRule ^index.php/(.*) /$1 [R,L]

RewriteCond %{HTTP_HOST} !^(www\.yourdomain\.com)?$
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
########## End - 301 Redirect


*****************************************************************
 
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.yourdomain.com [R=301,L] 
 
RewriteCond %{REQUEST_URI} ^/index\.php/
RewriteRule ^index.php/(.*) /$1 [R,L]