Posted By

Queasy on 10/05/14


Tagged

htaccess


Versions (?)

htaccess


 / Published in: Apache
 

URL: Drop in a URL...

htaccess file

  1. ## Can be commented out if causes errors, see notes above.
  2. #
  3. Options +FollowSymLinks
  4. #
  5. ## Mod_rewrite in use.
  6. #
  7. RewriteEngine On
  8. #
  9. #
  10. #RewriteCond %{QUERY_STRING} !(^|&)option=com_jbetolo [NC]
  11. #
  12. # RewriteCond %{HTTPS} on
  13. # RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  14. #
  15. #Redirect any domain to domainname.com
  16. #
  17. RewriteCond %{HTTP_HOST} !^www\.domainname\.com [NC]
  18. RewriteCond %{HTTP_HOST} !^$
  19. RewriteRule ^/?(.*) http://www.domainname.com/$1 [L,R,NE]
  20. #
  21. #
  22. RewriteRule ^forums/forum-group/forum/(.*)$ /forum/$1 [R=301,L]
  23. RewriteRule ^forum-new/(.*)$ /forum/$1 [R=301,L]
  24. RewriteRule ^kunena/(.*)$ /forum/$1 [R=301,L]
  25. RewriteRule ^forums/(.*)$ /forum/$1 [R=301,L]
  26. #RewriteRule ^index/(.*)$ /forum/$1 [R=301,L]
  27. RedirectMatch 301 ^/(.+?)/[0-9]+$ /$1
  28. #
  29. #
  30. # Block out any script trying to base64_encode data within the URL.
  31. RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
  32. # Block out any script that includes a <script> tag in URL.
  33. RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
  34. # Block out any script trying to set a PHP GLOBALS variable via URL.
  35. RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
  36. # Block out any script trying to modify a _REQUEST variable via URL.
  37. RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
  38. # Return 403 Forbidden header and show the content of the root homepage
  39. RewriteRule .* index.php [F]
  40. #
  41. ## End - Rewrite rules to block out some common exploits.
  42. Header unset Cookie
  43. # Header unset Set-Cookie
  44. ## Begin - Custom redirects
  45. #
  46. # If you need to redirect some pages, or set a canonical non-www to
  47. # www redirect (or vice versa), place that code here. Ensure those
  48. # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
  49. #
  50. ## End - Custom redirects
  51.  
  52. ##
  53. # Uncomment following line if your webserver's URL
  54. # is not directly related to physical file paths.
  55. # Update Your Joomla! Directory (just / for root).
  56. ##
  57.  
  58. # RewriteBase /
  59.  
  60. ## Begin - Joomla! core SEF Section.
  61. #
  62. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  63. #
  64. # If the requested path and file is not /index.php and the request
  65. # has not already been internally rewritten to the index.php script
  66. RewriteCond %{REQUEST_URI} !^/index\.php
  67. # and the requested path and file doesn't directly match a physical file
  68. RewriteCond %{REQUEST_FILENAME} !-f
  69. # and the requested path and file doesn't directly match a physical folder
  70. RewriteCond %{REQUEST_FILENAME} !-d
  71. # internally rewrite the request to the index.php script
  72. RewriteRule .* index.php [L]
  73. #
  74. ## End - Joomla! core SEF Section.

Report this snippet  

You need to login to post a comment.