Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. /
  2. ·--index.php
  3. |
  4. ·--/about-us/
  5. | |
  6. | ·--index.php
  7. ·--/contact-us/
  8. |
  9. ·--index.php
  10.  
  11. # Options
  12. Options +FollowSymLinks -MultiViews -Indexes
  13. DirectoryIndex index.php index.html
  14. DirectorySlash off
  15.  
  16. # Enable Rewrite Engine
  17. RewriteEngine on
  18. RewriteBase /
  19.  
  20. # www to non-www
  21. RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
  22. RewriteCond %1##%{HTTPS}s ^(.+)##(?:on(s)|)
  23. RewriteRule ^ http%2://%1%{REQUEST_URI} [L,R=301,NE]
  24.  
  25. # remove trailing slash from all URLs
  26. RewriteCond %{THE_REQUEST} s(.+?)/+[?s]
  27. RewriteRule ^(.+)/$ /$1 [R=301,L,NE]
  28.  
  29. # To externally redirect /dir/file.php to /dir/file
  30. RewriteCond %{THE_REQUEST} s/+(.+?).php[s?] [NC]
  31. RewriteRule ^ /%1 [R=301,NE,L]
  32.  
  33. # internally add trailing / to directories
  34. RewriteCond %{REQUEST_FILENAME} -d
  35. RewriteRule !/$ %{REQUEST_URI}/ [L]
  36.  
  37. # To internally forward /dir/file to /dir/file.php
  38. RewriteCond %{DOCUMENT_ROOT}/$1.php -f [NC]
  39. RewriteRule ^(.+?)/?$ $1.php [L]
  40.  
  41. <FilesMatch ^.>
  42. order allow,deny
  43. deny from all
  44. </FilesMatch>
  45.  
  46. <Files *.inc>
  47. order allow,deny
  48. deny from all
  49. </Files>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement