0
My website open properly when I type `www.abc.com` on browser but when I type `abc.com` it opens page of subdomain which I have hosted which is `admin.abc.com`.
But the url still says `abc.com`
Here is my .htaccess code:
<!-- language: lang-bash -->
RewriteEngine on
RewriteBase/
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
I am using Ubuntu 14.04 with Apache and have configured virtual hosts for both domains.
Any guidance will be highly appreciated.
這是我的conf文件abc.com上傳到服務器上的域和子域。在Ubuntu上codeigniter安裝htaccess問題
<!-- language: lang-bash -->
# domain: abc.com
# public: /var/www/abc.com/public_html/
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/localcerts/c8d39f3574580de6.crt
SSLCertificateKeyFile /etc/ssl/localcerts/abc.key
SSLCertificateChainFile /etc/ssl/localcerts/gd_bundle-g2-g1.crt
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName abc.com
ServerAlias abc.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/abc.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/abc.com/log/error.log
CustomLog /var/www/abc.com/log/access.log Combined
</VirtualHost>
這裏是admin.abc.com
<!-- language: lang-bash -->
# domain: admin.abc.com
# public: /var/www/admin.abc.com/public_html/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName admin.abc.com
ServerAlias admin.abc.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/admin.abc.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/admin.abc.com/log/error.log
CustomLog /var/www/admin.abc.com/log/access.log combined
</VirtualHost>
我的conf文件確實讓我們知道,如果上述的conf文件,其中有助於確定問題,期待您的回覆。
我已經有兩個conf文件同時用於abc.com和admin.abc.com ,它們都指向它們各自的根目錄。不知道爲什麼它發生,現在正在掙扎幾天。 – user3637820
你可以發佈這兩個.config文件的地方我可以看看它嗎?如果你有一個.config文件,你爲什麼使用.htaccess? –
我已添加上面的文件,你可以請檢查。我使用htaaccess因爲重定向所有HTTP到https – user3637820