简体   繁体   English

web / app.php没有在symfony2中删除

[英]web/app.php is not removing in symfony2

i have created first Symfony application but the url is so large 我创建了第一个Symfony应用程序,但是URL太大

http:// ip address/repair/web/app_dev.php/home http:// ip地址/修复/web/app_dev.php/home

http:// ip address/repair/web/app.php/home http:// ip地址/修复/web/app.php/home

i want to make it as http:// ip address/repair/home 我想将其设为http:// ip地址/维修/家

here is httpd.conf of apache2 这是apache2的httpd.conf

NameVirtualHost something ip address NameVirtualHost的IP地址

ServerName "repair" ServerName“修复”

DocumentRoot "/var/www/repair/web"

<Directory "/var/www/repair/web">
   DirectoryIndex app.php
    AllowOverride None
    Order allow,deny
    Allow from All
 RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
    RedirectMatch permanent ^/app\.php/(.*) /$1
</Directory>

my .htaccess of in web folder of symfony contains 我的symfony的Web文件夹中的.htaccess包含

Options +FollowSymlinks

RewriteEngine On  

# Explicitly disable rewriting for front controllers
RewriteRule ^app.php - [L]
RewriteRule ^app.php - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]

i have reloded the mod-Rewrite of apache2 too 我也取消了apache2的mod-Rewrite

iam getting error 我越来越错误

The requested URL /repair/home was not found on this server. 在此服务器上找不到请求的URL / repair / home。

Apache/2.2.20 (Ubuntu) Server at ip address Port 80 IP地址为端口80的Apache / 2.2.20(Ubuntu)服务器

如果要通过ip访问站点,则需要将代码复制到“ localhost”目录(例如,/ var / www)

The AllowOverride None line in your Apache config is causing the .htaccess file to be ignored. 您的Apache配置中的AllowOverride None行导致.htaccess文件被忽略。

If you replace it with AllowOverride All Apache will follow the directives in your .htaccess file. 如果将其替换为AllowOverride All Apache将遵循.htaccess文件中的指令。

You can find more information about AllowOverride here 您可以在此处找到有关AllowOverride的更多信息

Double-check that you actually have mod-rewrite loaded for Apache. 仔细检查您是否实际上已为Apache加载了mod-rewrite。 On a Debian 6 install with Apache 2, the module was available, but it wasn't loaded. 在使用Apache 2的Debian 6安装中,该模块可用,但尚未加载。 In order to load it, you can add a symlink in the mods-enabled directory to the module in the mods-available directory like this: 为了加载它,您可以在启用mods的目录中将符号链接添加到mods-available目录中的模块,如下所示:

root@server:/etc/apache2/mods-enabled# ln -s ../mods-available/rewrite.load ./rewrite.load

Then you'll need to restart Apache2 to get it to reload its configuration. 然后,您需要重新启动Apache2才能重新加载其配置。 On Debian that would be sudo service apache2 restart 在Debian上,这将是sudo service apache2 restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM