我使用debian服务器,我希望用isAdress/register更改我的URL ipAdresse:9999/app.php/register。
我已经成功地删除了.../web/...。但不是.../app.php/...
我有一个虚拟主机:
Listen ipAdress:9999
<VirtualHost ipAdress:9999>
DocumentRoot "/var/www/SuperSwungBall/web"
DirectoryIndex app.php
<Directory "/var/www/SuperSwungBall/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>和~/web中的.htaccess:
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^app.php - [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>我还尝试了默认的symfony ~/web/..htaccess。但是,这不管用。
谢谢!
发布于 2016-05-30 20:49:45
本文描述了关于如何配置webserver以通过app.php路由所有请求的两个示例,这些请求都具有干净的URL:configuration.html
在您的示例中,虚拟主机应该如下所示:
<VirtualHost *:9999>
DocumentRoot /var/www/SuperSwungBall/web
<Directory /var/www/SuperSwungBall/web>
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
<Directory /var/www/SuperSwungBall/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>https://stackoverflow.com/questions/37533355
复制相似问题