Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Preview Site

Posted on 2014-02-10
1
Medium Priority
?
226 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
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…
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

824 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