我想从 URL 中隐藏“index.php”,但它根本不起作用。我通过谷歌,堆栈尝试了很多东西,但它根本没有帮助我。我的 .htaccess 文件中指定了以下规则。此外,当我使用“https://www.domain.com/index.php/login”访问 URL 时,它可以正常工作,但是当我使用“https://www.domain.com/login”访问该站点时,它会显示404 页面(找不到页面)。我不确定我是否遗漏了什么。[注意:我使用的是 symfony 1.4,我也尝试使用http://www.symfony-project.org/plugins/lapeSSLFilterPlugin之类的过滤器来处理 ssl,但它不起作用。我还检查了 ssl 的错误日志,但在日志中没有收到任何相关错误。]
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
RewriteBase /
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
ssl.conf 文件包含以下内容:
LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost _default_:443>
DocumentRoot /var/www/html/domain/web
ServerName www.domain.com
RewriteEngine On
DirectoryIndex index.php
Alias /sf /var/www/html/domain/lib/vendor/symfony/data/web/sf
<Directory "/var/www/html/domain/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
<Directory "/var/www/html/domain/web">
AllowOverride All
Allow from All
</Directory>
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLCertificateFile /etc/ssl/certs/domain.com.crt
SSLCertificateKeyFile /etc/ssl/certs/domain.key
SSLCertificateChainFile /etc/ssl/certs/gd_bundle.crt
SSLCACertificateFile /etc/ssl/certs/gd_bundle.crt
</VirtualHost>
httpd.conf 文件包含以下虚拟主机设置:
<VirtualHost *:80>
ServerName www.domain.com
DocumentRoot "/var/www/html/domain/web"
DirectoryIndex index.php
RewriteEngine On
<Directory "/var/www/html/domain/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /var/www/html/domain/lib/vendor/symfony/data/web/sf
<Directory "/var/www/html/domain/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
任何帮助将不胜感激。