我想隱藏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,但我不會在日誌中得到任何相關的錯誤]隱藏「https」連接的index.php?
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文件包含以下entires:
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>
任何幫助將不勝感激。
重複的http://stackoverflow.com/q/905030/212940? – vascowhite
看看接受的答案,它也適用於你。如果你仔細閱讀我的評論,你會看到一個'?'最後意味着這是一個問題。它旨在幫助你,所以不要感到不安。 – vascowhite
@vascowhite:道歉。我也嘗試過,但沒有幫助。感謝您的答覆。 –