Solved

Preview Site

Posted on 2014-02-10
1
215 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
nslookup returns non-existing domain 5 56
LINUX, CPANEL & WHM 5 44
Problem with autodiscover SBS 2011 4 72
active directory 3 39
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

22 Experts available now in Live!

Get 1:1 Help Now