httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yehuda Katz <yeh...@ymkatz.net>
Subject Re: [users@httpd] Public Vs. Development (Private) URL to Document: Not Same Document Roots For Absolute URLs of Supporting Documents
Date Mon, 07 Oct 2013 18:34:51 GMT
I usually create vhosts for development for this reason.

I would add a vhost for something like opinion.localhost (and add that to
your hosts file).

The only other option would be using some type of CMS that is aware of the
multiple access paths.

- Y


On Mon, Oct 7, 2013 at 8:12 AM, Steve Penner <stevepenner1960@gmail.com>wrote:

>  Apache/2.4.3 (Win32) OpenSSL/0.9.8x PHP/5.4.8
>
> The (Windows) filesystem for my server this Windows path:
>
>      Z:\service.web.opinions
>
> The tree under Z:\service.web.opinions is:
>
> Z:\service.web.opinions
>    * developing
>    * _content
>       ++ opinionDocs.js
>       ** culture
>         +++ elections.html
>       ** politics
>       ** groups
>
> Note that
>    "**" is a directory/folder within the directory/folder "_content"
>    "++" is an file in the directory "_content"
>    "+++" is a file in the directory "culture"
>
> Finally two more very important bits of information as to the server
> config:
>
> In my *httpd.conf* file, I have
>
>      Alias /opinion    "Z:/service.web.opinions/_content"
>
> In my *httpd-**vhosts.conf* file, I have:
>
> <VirtualHost *:80 *:8080 *:8008>
>     ServerAdmin bigopinions@yahoo.com
>     DocumentRoot "Z:/service.web.opinions/_content"
>     ServerName truth-and-opinion.org
>     ServerAlias www.truth-and-opinion.org
>     ErrorLog "|\"C:/_Windows Uninstalled
> Applications/Apache24/bin/rotatelogs.exe\"
> \"D:/WebServerConfig/httpd/logs/truth-and-opinion.org-error%Y%b%d.log\"
> 7776000"
>     CustomLog "|bin/rotatelogs.exe
> D:/WebServerConfig/httpd/logs/truth-and-opinion.org-access%Y%b%d.log 5M"
> combined env=!image-request
>     Options Indexes FollowSymLinks
> </VirtualHost>
>
> In this configuration, I have an HTML document "elections.html" in the
> Windows path Z:\service.web.opinions\_content\culture\elections.html.
> This is accessed by the public as
> "http://my.opinions.org/culture/elections.html"<http://my.opinions.org/culture/elections.html>
>
> HERE IS THE PROBLEM
>
> I personally/privately (as a developer?) want to access the site content
> using a *localhost* or *127.0.0.1* url, namely "http://localhost/opinion/"<http://localhost/opinion/>
>
> The document "elections.html" contains the HTML markup:
>
>     <script type="text/javascript" src="/opinionDocs.js"></script>
>
> That JavaScript file is in the path
> "Z:\service.web.opinions\_content\opinionDocs.js"
>
> The public access is okay, because the DocumentRoot for the public access
> "Z:\service.web.opinions\_content\"  and so the "src" attribute points to
> the root "/" where opinion docs is located.
>
> But when I use "http://localhost/opinion/culture/elections.html"<http://localhost/opinion/culture/elections.html>(or
> "http://127.0.0.1/opinion/culture/elections.html"<http://127.0.0.1/opinion/culture/elections.html>,
> I will get a 404 Not Found error.   The error will be that
> "http://localhost/opinionDocs.js" <http://localhost/opinionDocs.js> (or
> "http://127.0.0.1/opinionDocs.js" <http://127.0.0.1/opinionDocs.js>) was
> not found.
>
> Obviously the "Alias" feature is the wrong feature to use, and it should
> probably be another <VirtualHost> directive, right?
>
>
>

Mime
View raw message