jhebb

.htaccess index redirect with custom 404s

Dec 18th, 2012
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. DirectoryIndex index.php
  2.  
  3. Options -Indexes
  4.  
  5. RewriteEngine On
  6.  
  7. RewriteBase /
  8.  
  9. RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
  10. RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  11.  
  12. ErrorDocument 404 /customerrors/404.html
  13.  
  14.  
  15. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
  16. RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]
  17.  
  18.  
  19. RewriteRule ^index\.php$ - [L]
  20.  
  21. ## RewriteCond %{REQUEST_FILENAME} !-f
  22. ## RewriteCond %{REQUEST_FILENAME} !-d
  23. ## RewriteRule . /index.php [L]
Advertisement
Add Comment
Please, Sign In to add comment