Solved

Preview Site

Posted on 2014-02-10
1
216 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
ID: 39849882
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
W 10 Workstation can't join Win 2012 domain 12 59
Recipient domain does not exist in DNS 7 46
Can't ping New Linux Servers 40 64
Cpanel file manager 8 21
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

9 Experts available now in Live!

Get 1:1 Help Now