将 .htaccess 集成到 httpd.conf 中
我在 /connect 文件夹中有以下 htaccess 文件,我需要将其集成到 httpd.conf 文件(已包含命令):
/connect/.htaccess
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteBase /connect
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
httpd.conf
...
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/alter
ServerName www.mysite.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
...
....
我不确定如何适应上述内容进入下面?
I'vee got the following htaccess file in /connect folder and I need to integrate this into an httpd.conf file (which has commands already):
/connect/.htaccess
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteBase /connect
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
httpd.conf
...
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/alter
ServerName www.mysite.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
...
....
I'm not sure how I can fit the above into the below?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.htaccess 本质上是 httpd.conf 中块的核心,因此您需要类似的内容
,但是,只有在您确信 .htaccess 正常工作并且不会被更改(很多)后,您才应该有这样的机会)不再。对 httpd.conf 的任何更改都需要您退回服务器,而 .htaccess 更改会立即对下一个请求生效。
A .htaccess is essentially the guts of a block in httpd.conf, so you'd want something like
Though, you should only make such a chance once you're satisified that the .htaccess is working properly and will not be changed (much) anymore. Any changes to httpd.conf require you to bounce the server, while .htaccess changes take effect immediately for the next request.