Guest User

Untitled

a guest
Jan 23rd, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. https://www.mywebsite.co.uk/mypage
  2.  
  3. RewriteEngine On
  4.  
  5. RewriteBase /
  6.  
  7. # Force WWW prefix
  8. RewriteCond %{HTTP_HOST} !^$
  9. RewriteCond %{HTTP_HOST} !^www. [NC]
  10. RewriteCond %{HTTPS}s ^on(s)|
  11. RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  12.  
  13. # Force SSL
  14. RewriteCond %{HTTPS} off
  15. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
  16.  
  17. # Remove .php extension
  18. RewriteCond %{THE_REQUEST} ^GET /[^?s]+.php
  19. RewriteRule (.*).php$ /$1/ [L,R=301]
  20.  
  21. RewriteCond %{REQUEST_FILENAME} !-f
  22. RewriteCond %{REQUEST_FILENAME} !-d
  23. RewriteCond %{REQUEST_URI} ^/(.+)/$
  24. RewriteCond %{DOCUMENT_ROOT}/%1.php -f
  25. RewriteRule ^(.*)/$ $1.php [L]
  26.  
  27. # Force trailing slash
  28. RewriteCond %{REQUEST_FILENAME}.php -f
  29. RewriteRule .*[^/]$ $0/ [L,R=301]
  30.  
  31. https://www.mywebsite.co.uk/mypage
  32.  
  33. https://www.mywebsite.co.uk/mypage/
Add Comment
Please, Sign In to add comment