Guest User

htaccess

a guest
Oct 12th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. # Use the front controller as index file. It serves as a fallback solution when
  2. # every other rewrite/redirect fails (e.g. in an aliased environment without
  3. # mod_rewrite). Additionally, this reduces the matching process for the
  4. # start page (path "/") because otherwise Apache will apply the rewriting rules
  5. # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
  6. DirectoryIndex index.php
  7.  
  8. # By default, Apache does not evaluate symbolic links if you did not enable this
  9. # feature in your server configuration. Uncomment the following line if you
  10. # install assets as symlinks or if you experience problems related to symlinks
  11. # when compiling LESS/Sass/CoffeScript assets.
  12. # Options FollowSymlinks
  13.  
  14. # Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve
  15. # to the front controller "/index.php" but be rewritten to "/index.php/index".
  16. <IfModule mod_negotiation.c>
  17. Options -MultiViews
  18. </IfModule>
  19.  
  20. <IfModule mod_rewrite.c>
  21. RewriteEngine On
  22. RewriteRule ^$ https://srad.wtf/es_ES/ [R=302,L]
  23. #HTTP-HTTPS
  24. RewriteCond %{HTTPS} off
  25. RewriteRule (.*) https://srad.wtf/es_ES/$1 [R=301,L,QSA]
  26.  
  27. # Determine the RewriteBase automatically and set it as environment variable.
  28. # If you are using Apache aliases to do mass virtual hosting or installed the
  29. # project in a subdirectory, the base path will be prepended to allow proper
  30. # resolution of the index.php file and to redirect to the correct URI. It will
  31. # work in environments without path prefix as well, providing a safe, one-size
  32. # fits all solution. But as you do not need it in this case, you can comment
  33. # the following 2 lines to eliminate the overhead.
  34. RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
  35. RewriteRule ^(.*) - [E=BASE:%1]
  36.  
  37. # Sets the HTTP_AUTHORIZATION header removed by Apache
  38. RewriteCond %{HTTP:Authorization} .
  39. RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  40.  
  41. # Redirect to URI without front controller to prevent duplicate content
  42. # (with and without `/index.php`). Only do this redirect on the initial
  43. # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
  44. # endless redirect loop (request -> rewrite to front controller ->
  45. # redirect -> request -> ...).
  46. # So in case you get a "too many redirects" error or you always get redirected
  47. # to the start page because your Apache does not expose the REDIRECT_STATUS
  48. # environment variable, you have 2 choices:
  49. # - disable this feature by commenting the following 2 lines or
  50. # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
  51. # following RewriteCond (best solution)
  52. RewriteCond %{ENV:REDIRECT_STATUS} ^$
  53. RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
  54.  
  55. # If the requested filename exists, simply serve it.
  56. # We only want to let Apache serve files and not directories.
  57. RewriteCond %{REQUEST_FILENAME} -f
  58. RewriteRule ^ - [L]
  59.  
  60. # Rewrite all other queries to the front controller.
  61. RewriteRule ^ %{ENV:BASE}/index.php [L]
  62. </IfModule>
  63.  
  64. <IfModule !mod_rewrite.c>
  65. <IfModule mod_alias.c>
  66. # When mod_rewrite is not available, we instruct a temporary redirect of
  67. # the start page to the front controller explicitly so that the website
  68. # and the generated links can still be used.
  69. RedirectMatch 307 ^/$ /index.php/
  70. # RedirectTemp cannot be used instead
  71. </IfModule>
  72. </IfModule>
  73.  
Add Comment
Please, Sign In to add comment