我有一個共享的託管。 我希望看到.htaccess文件的一個例子的public_html文件夾設置一個Symfony2的應用程序(入口點是網/ app.php) 感謝很多提前共享主機中的symfony2 htaccess
1
A
回答
0
symfony的標準版中已經包含了.htaccess你可以使用。
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>
+2
但這是web文件夾中的.htaccess ,我需要一個.htaccess來放置在symfony2項目所在的public_html目錄中 – Oriam
0
試試這個:
DirectoryIndex public_html/app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public_html/
RewriteRule (.*) /public_html/$1
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 302 ^/$ /public_html/app.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
設置它的根文件夾,上面public_html
一個級別。
相關問題
- 1. Symfony2的 - 在共享主機
- 2. 的.htaccess共享主機
- 3. 關於nginx共享主機上的Symfony2
- 4. Symfony2 500響應共享主機
- 5. bcmath在共享主機通過.htaccess
- 6. Laravel 5共享主機子域名htaccess
- 7. htaccess的在共享宿主
- 8. 如何在共享主機
- 9. 1and1共享主機mod_rewrite
- 10. LiteSpeed設置 - 共享主機
- 11. 如何在共享主機上部署Symfony2?
- 12. 在共享主機
- 13. 在共享主機
- 14. 在共享主機
- 15. 共享Ip主機
- 16. Django共享主機設置
- 17. 如何在共享主機
- 18. 共享主機.htacess主域範圍內的.htaccess
- 19. CakePHP:共享主機困境
- 20. 共享主機環境中的CakePHP和.htaccess
- 21. 共享主機上的Web.py
- 22. 共享主機上的graylog
- 23. 共享主機上的ejabberd
- 24. 共享主機上的GeoIP
- 25. 共享主機上的Symfony2.2
- 26. 共享主機上的BasicHTTPServer
- 27. 共享主機上的CakePHP public_html
- 28. laravel ajax共享主機
- 29. 在共享主機環境中通過.htaccess重寫URL
- 30. 的.htaccess不laravel對生產服務器的共享主機
https://github.com/symfony/symfony-standard/blob/master/web/.htaccess - 此外,沒有SSH訪問,使用Symfony將是痛苦的 –