2016-09-28 2 views
0

Я создал субдомна под моим сервером WAMP для мобильного сайта и использует IP-адрес, имя домена, который 192.168.106.1перезаписи URL не работает в WAMP субдомна

Но проблема в том, что, когда я пытаюсь переписать URL в мой файл .htaccess, я не работаю. И я использую дублированный .htaccess файл, который работает для localhost

Ниже моя конфигурация сервера для доменного имени в моем httpd.conf файле

<VirtualHost 192.168.106.1> 
#LoadModule rewrite_module modules/mod_rewrite.so 
# The name to respond to 
ServerName m.localhost 
# Folder where the files live 
DocumentRoot "C:/wamp/www/mobile/" 
# A few helpful settings... 
<Directory "C:/wamp/www/mobile/"> 
Allow from all 
Order Allow,Deny 
# Enables .htaccess files for this site 
AllowOverride All 
</Directory> 
# Apache will look for these two files, in this order, if no file is specified in the URL 
DirectoryIndex index.html index.php 
</VirtualHost> 

Я также удалил тег комментария на второй линии, но это еще не за работой.

Пожалуйста, кто-нибудь с решением?

ответ

0

Вот решение

Сначала убедитесь, что вы идете в C:/wamp/bin/apache/YOUR APACHE VERSION/conf и открыть файл httpd.conf и раскомментировать эту строку

#Include conf/extra/httpd-vhosts.conf 

Так это будет выглядеть как этот

Include conf/extra/httpd-vhosts.conf 

Затем также откройте файл host, расположенный в C:/windows/System32/drivers/etc, и добавьте это (ваш IP-адрес в конфигурацию)

#add the sub-domain name, in this case I use mobile, it can be anything 
192.168.106.1 mobile.localhost 
192.168.106.1 192.168.106.1 

Тогда, наконец, и самое главное, открыть файл vhost в C:/wamp/bin/apache/YOUR APACHE VERSION/conf/extra/httpd-vhosts.conf и добавить в файл

<VirtualHost *:80> 
    DocumentRoot "C:/wamp/www/mobile" 
    ServerName m.localhost 
    Options Indexes FollowSymLinks 
    <Directory "C:/wamp/www/mobile"> 
     AllowOverride All 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 
     #If you want to allow access from your internal network 
     # For specific ip addresses add one line per ip address 
     Allow from 192.168.106.1 
     # For every ip in the subnet, just use the first 3 numbers of the subnet 
     #Allow from 192.168.0 
    </Directory> 
</VirtualHost> 

Затем перезапустите сервер WAMP и работает

Смежные вопросы