Advertisement
Guest User

Untitled

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