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, который загружается на сервер как для домена, так и для поддомена.htaccess issue on codeigniter setup on ubuntu
<!-- 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 для обоих abc.com и admin.abc.com , и оба они указывают на соответствующий корневой каталог. Не уверен, почему это происходит, борясь с этим уже пару дней. – user3637820
Не могли бы вы разместить эти два файла .config где-нибудь, я мог бы взглянуть на него? И почему вы используете .htaccess, если у вас есть файл .config? –
Я добавил файлы выше, вы можете проверить PLS. Я использую htaaccess coz для перенаправления всех http на https – user3637820