Solved

Preview Site

Posted on 2014-02-10
1
214 Views
Last Modified: 2014-02-26
Ive been used to always editing the hosts file and adding the website Im working on to the Apache conf file as a vhost, but its a right pain when working on multiple PCs. On my webhost site I can preview a site before it goes live, and Im wondering how you do that.

I can see on certain sites that phpMyAdmin is put in as a alias:-
Alias /phpmyadmin "c:/htdocs/phpmyadmin/"

<Directory "c:/htdocs/phpmyadmin/">
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Open in new window


However when I try and add my site into it, such as:-
Alias /mySite1 "c:/htdocs/mySite1/"

<Directory "c:/htdocs/mySite1/">
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Open in new window


And navigate to http://localhost/mySite1 It has issues pulling in scripts and images, however works fine accessing it from http://mySite1 after I set it up as a vhost:-
<VirtualHost *:80>
	DocumentRoot c:/htdocs/mySite1/
	ServerName mySite1
</VirtualHost>

Open in new window


And edit my hosts file to:-
127.0.0.1     mySite1

Open in new window


I had thought about using a portable DNS server which I could just run, and on the development machine just point the primary DNS to 127.0.0.1 but I cannot find a portable DNS server, only ones that install - do not understand why, maybe a project for me in the future, but not at the moment.

Any ideas how to preview a site from localhost instead of having to edit the hosts file continuously?

Thank you
0
Comment
Question by:tonelm54
1 Comment
 
LVL 26

Accepted Solution

by:
arober11 earned 500 total points
Comment Utility
Guessing your markup has absolute paths in it e.g.

="/image/xxxx.jpg"
="/js/xxxxx.js"

If you go through the HTML and remove the leading slashes, to make the paths relative, pic's and scripts may start to appear.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I will assume you are running a non-server version of some sort of Windows throughout this article. There are many flavors of Windows since Windows Server 2000 - 2008, XP Home & Pro, Vista Home & Pro, and Windows 7 Starter, Home, Pro, Ultimate, etc.…
Occasionally you run into the website or two that will not resolve properly using your own DNS servers.  Some people simply set up global forwarders for their DNS server.  I don’t recommend doing this because it can cause problems resolving addresse…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now