Apache 为“隐藏index.php”;https";联系?
我想从URL中隐藏“index.php”,但它根本不起作用。我通过谷歌stack尝试了很多东西,但对我一点帮助都没有。我在.htaccess文件中指定了以下规则。此外,当我使用“https://www.domain.com/index.php/login“它工作正常,但当我使用”https://www.domain.com/login“然后显示404页(找不到页)。我不确定我是否遗漏了什么。[注意:我使用的是symfony 1.4,我也尝试过使用类似的过滤器来处理ssl,但不起作用。我还检查了ssl的错误日志,但没有在日志中发现任何相关错误。]Apache 为“隐藏index.php”;https";联系?,apache,.htaccess,https,url-rewriting,symfony-1.4,Apache,.htaccess,Https,Url Rewriting,Symfony 1.4,我想从URL中隐藏“index.php”,但它根本不起作用。我通过谷歌stack尝试了很多东西,但对我一点帮助都没有。我在.htaccess文件中指定了以下规则。此外,当我使用“https://www.domain.com/index.php/login“它工作正常,但当我使用”https://www.domain.com/login“然后显示404页(找不到页)。我不确定我是否遗漏了什么。[注意:我使用的是symfony 1.4,我也尝试过使用类似的过滤器来处理ssl,但不起作用。我还检查了s
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>
Options+FollowSymLinks+ExecCGI
重新启动发动机
#如果遇到问题,请取消对以下行的注释
#无法使用脚本名称
重写基/
#我们跳过了所有的文件
#重写条件%{REQUEST_URI}\+$
#重写条件%{REQUEST\u URI}!\。html$
#重写规则。*-[L]
#我们检查.html版本是否在这里(缓存)
重写规则^$index.html[QSA]
重写规则^([^.]+)$$1.html[QSA]
重写cond%{REQUEST_FILENAME}-F
#不,所以我们重定向到前端web控制器
重写cond%{SERVER\u PORT}^443$
重写规则^.*$https://%{SERVER_NAME}%{REQUEST_URI}[R=301,L]
重写规则^(.*)$index.php[QSA,L]
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>
LoadModule ssl\u module modules/mod\u ssl.so
听我说
DocumentRoot/var/www/html/domain/web
服务器名www.domain.com
重新启动发动机
DirectoryIndex.php
别名/sf/var/www/html/domain/lib/vendor/symfony/data/web/sf
允许超越所有
通融
允许超越所有
通融
错误日志/ssl\u错误日志
传输日志/ssl访问日志
日志级别警告
斯伦金安
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
httpd.conf文件包含以下vhost设置:
<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>
服务器名www.domain.com
DocumentRoot“/var/www/html/domain/web”
DirectoryIndex.php
重新启动发动机
允许超越所有
通融
别名/sf/var/www/html/domain/lib/vendor/symfony/data/web/sf
允许超越所有
通融
任何帮助都将不胜感激。没有index.php和http(不是https)的站点工作吗 如果站点在没有https的http中无法工作,那么问题可能出在symfony部分。你能给我们看看你的
应用程序/[你的应用程序]/config/settings.yml
?特别注意以下选项:
no\u script\u name
设置确定前控制器
脚本名称是否在生成的URL前加前缀。默认情况下,它是
通过应用程序的prod
环境的generate:app
任务设置为true
创建了第一个应用程序
问题在于你的symfony配置。 所有apache配置文件都正常 您需要将其添加到global security.yml中
default:
is_secure: false
is_ssl: true
secure:
is_secure: false
is_ssl: true
signin:
is_secure: false
is_ssl: true
signout:
is_secure: false
sfGuardAuth/config/security.yml
default:
is_secure: false
is_ssl: true
secure:
is_secure: false
is_ssl: true
signin:
is_secure: false
is_ssl: true
signout:
is_secure: false
如果你不想在你的URL集中有“index.php”
no_script_name: true
在您的全局应用程序设置中.yml重复?请查看已接受的答案,它也适用于您。如果你仔细阅读我的评论,你会在最后看到一个“?”,这意味着这是一个问题。这是为了帮助你,所以不要生气。@vascowhite:道歉。我也试过了,但没用。感谢您的回复。对于所有环境,no_script_名称都设置为false。我想我在ssl.conf或httpd.conf中遗漏了一些东西。你能看一下吗?我看不出有什么问题,你的网站是在没有index.php的http上工作的吗?你启用了(RewriteLog&RewriteLogLevel>3)吗?是的,当我使用http连接时,没有index.php,该站点运行良好。[即:。重写也被启用为5。我认为,如果我们能在这里而不是私下解决问题,对每个人来说都更好。重写日志文件对404有何说明?:它在“/var/www/html/domain/web/”中找不到/login。小心,它来自一个插件,而不是symfony本身。