简体   繁体   中英

access website with vhost, htaccess on windows

I have a website. This website doesn't have index.php. For every request, i redirect via htaccess to a dir/file that includes the code to each page, based on the url. Everything works fine on localhost (and i access in my machine as "projetositeA/"). Now i wanted to access this website on my LAN with another device, to test the layout. So put on the vhost:

Alias /siteA "c:/wamp/www/sites/siteA/projeto"
<VirtualHost *:80>
    ServerName projetositeA
    DocumentRoot "c:/wamp/www/sites/siteA/projeto"
    <Directory  "c:/wamp/www/sites/siteA/projeto/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

My htaccess is:

Options -Indexes            

ErrorDocument 400 /site/page
ErrorDocument 401 /site/page
ErrorDocument 403 /site/page
ErrorDocument 404 /site/page
ErrorDocument 408 /site/page

ErrorDocument 500 /site/page
ErrorDocument 502 /site/page
ErrorDocument 503 /site/page
ErrorDocument 504 /site/page
ErrorDocument 505 /site/page


RewriteBase /

RewriteRule ^(|inicio$|missao|servicos|blog|depoimentos|duvidas|contato|noticia)$   site/page.php

The structure of my directories are:

c:/wamp/www/sites/siteA/projeto/site/page.php

Every code on php inside.../site/

When i tried to access like this: 192.168.0.14/siteA it gives me "not found". Every link on this domain that i tried gives me the same.

I have another website with index. And when i put 192.168.0.14/siteB it works perfectly.

I think i have to redirect the /siteA to root, but i dont know how. The root is already "localhost". What can i do??

Alias /siteA "c:/wamp/www/sites/siteA/projeto"

This Alias doesn't seem to make sense? Since the target of the Alias is the same as the document root, it would mean that accessing http://projetositeA/ and http://projetositeA/siteA would return the same files - which I'm sure is not the intention?

And when i put 192.168.0.14/siteA

However, when you access by the IP address you aren't using the specific vHost - it will likely default to the first one.

From the vHost you posted, to access "Site A" you should be using a URL of the form:

http://projetositeA/site/page

...as defined by the ServerName directive inside the <VirtualHost> .

?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM