Advertisement
Typhoon

SEO Friendly URL with .htaccess

Sep 25th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.51 KB | None | 0 0
  1. RewriteEngine On
  2.  
  3. RewriteRule ^(.*)index\.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]
  4.  
  5. RewriteBase /
  6. RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
  7. RewriteRule ^ %1 [R=301,L]
  8. RewriteCond %{REQUEST_FILENAME} !-d
  9. RewriteCond %{REQUEST_FILENAME}.php -f
  10. RewriteRule ^(.*?)/?$ $1.php [NC,L]
  11.  
  12. RewriteBase /
  13. RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
  14. RewriteRule ^ %1 [R=301,L]
  15. RewriteCond %{REQUEST_FILENAME} !-d
  16. RewriteCond %{REQUEST_FILENAME}.html -f
  17. RewriteRule ^(.*?)/?$ $1.html [NC,L]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement