它应该指向网络/后端.php,但当我尝试通过 URL 访问时,它会将我重定向到索引.php我的申请。
我不知道我做错了什么。
<VirtualHost *:80>
ServerName admin.my-app.com
DocumentRoot /var/www/myapp/web
DirectoryIndex backend.php
<Directory /var/www/myapp/web>
AllowOverride none
allow from all
</Directory>
Alias /sf /var/www/myapp/lib/vendor/symfony/data/web/sf
<Directory "/var/www/myapp/lib/vendor/symfony/data/web/sf">
AllowOverride none
Allow from All
</Directory>
ServerSignature Off
</VirtualHost>
这需要我:
<VirtualHost *:80>
ServerName www.my-app.com
DocumentRoot /var/www/myapp/web
DirectoryIndex index.php
<Directory /var/www/myapp/web>
AllowOverride All
allow from all
</Directory>
Alias /sf /var/www/myapp/lib/vendor/symfony/data/web/sf
<Directory "/var/www/myapp/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
ServerSignature Off
</VirtualHost>
和 .htaccess
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^my-app.com
RewriteRule (.*) http://www.my-app.com/$1 [R=301,L]
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
谢谢 ;)
答案1
RewiteRule
您最后.htaccess
设置的不是吗index.php
?