将.htaccess移至apache配置文件

时间:2018-12-11 03:32:06

标签: apache ubuntu mod-rewrite apache2 httpd.conf

我无法将.htaccess force https(SSL)重定向到我的apache配置文件。我想移动它,因为它将比.htaccess更快。它工作一半,但另一半不工作。因此.htaccess版本可以正常使用,但是站点配置apache版本不能正常运行。

.htaccess代码的工作方式如下:

// Shows the directory contents, does NOT redirect

https://blahblah.example.com -> https://example.com/profile/index.php?user=blahblah
https://blahblah.example.com/file1.php -> https://example.com/profile/file1.php

它不会重定向,只会显示内容/文件。

代码如下:

// part 2:
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.example\.com [NC]
RewriteRule ^/?$ /profile/index.php?user=%1 [L]
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} [^.]+\.example\.com [NC]
RewriteCond %{REQUEST_URI} ^/(.+)$
RewriteRule !^profile/ /profile/%1 [L]

如何将其移动到我的apache配置文件中? default-ssl.conf个文件?

0 个答案:

没有答案
相关问题