You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by barry kimelman <ba...@outlook.com> on 2015/09/06 20:08:29 UTC
[users@httpd] Can't get access to CSS stylesheets and javascript files using
Apache2.2 on windows
Hello,
I have installed apache2.2 on my windows laptop.
The basics are working fine. I setup my own directory structure under "C:\apachedata" and modified httpd.conf to point under that directory.
Accessing HTML pages works fine. CGI scripts that just generate HTML work fine.
However when I try to get access to CSS and JS files the apache error log keeps showing me the dreaded 403 error message
I have added the following line into httpd.conf
Alias /jslib "C:/apachedata/jslib"
Here is the "source code" generated by my CGI script which results in the 403 error emssage
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Encrypted Data Management</title>
<link rel="stylesheet" type="text/css" href="/jslib/styles.css<view-source:http://127.0.0.1/jslib/styles.css>" />
<link rel="stylesheet" type="text/css" href="/jslib/fieldset.css<view-source:http://127.0.0.1/jslib/fieldset.css>" />
<script src="/jslib/check_all_fields.js<view-source:http://127.0.0.1/jslib/check_all_fields.js>" type="text/JAVASCRIPT"></script>
<script src="/jslib/hide_show_divider.js<view-source:http://127.0.0.1/jslib/hide_show_divider.js>" type="text/JAVASCRIPT"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Encrypted Data Management</h1><H4>CGI script parameters</H4>
<H4>No CGI script parameters are defined</H4><BR>
<H3>Sun Sep 6 13:50:40 2015</H3>
<OL style="line-height: 35px;">
<LI><A HREF="e2.cgi?function=listall<view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=listall>">List Data</LI>
<LI><A HREF="e2.cgi?function=query<view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=query>">Query Data</LI>
<LI><A HREF="e2.cgi?function=add<view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=add>">Add New Record</LI>
<LI><A HREF="e2.cgi?function=meta<view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=meta>">List Metadata</LI>
</LI>
</OL>
</body>
</html>
Here is the contents of the jslib directory
Volume in drive C is TI10673200G
Volume Serial Number is 5E9D-3D3F
Directory of C:\apachedata\jslib
09/06/2015 01:04 PM <DIR> .
09/06/2015 01:04 PM <DIR> ..
09/06/2015 01:04 PM 1,396 check_all_fields.js
09/06/2015 11:32 AM 3,294 fieldset.css
09/06/2015 01:04 PM 1,515 hide_show_divider.js
09/06/2015 11:32 AM 5,929 styles.css
4 File(s) 12,134 bytes
2 Dir(s) 591,461,138,432 bytes free
Here is the tail end of "access.log"
127.0.0.1 - - [06/Sep/2015:13:53:13 -0400] "GET /jslib/fieldset.css HTTP/1.1" 403 220
127.0.0.1 - - [06/Sep/2015:13:53:13 -0400] "GET /jslib/hide_show_divider.js HTTP/1.1" 403 228
127.0.0.1 - - [06/Sep/2015:13:53:13 -0400] "GET /jslib/check_all_fields.js HTTP/1.1" 403 227
127.0.0.1 - - [06/Sep/2015:13:53:13 -0400] "GET /jslib/styles.css HTTP/1.1" 403 218
Any ideas ? What else do I need to do or change to properly access my CCS and JS files ?
Re: [users@httpd] Can't get access to CSS stylesheets and javascript
files using Apache2.2 on windows
Posted by Ashish Mistry <as...@gemsals.com>.
Hi Barry,
It seems you have used the absolute path of the .js and .css files. If
your code and .js & .css file are on the same folder or in child folders
of that then use the relative path for accessing .js and .css files.
Regards,
*Ashish Mistry*
>
> I have installed apache2.2 on my windows laptop.
>
>
> The basics are working fine. I setup my own directory structure under
> "C:\apachedata" and modified httpd.conf to point under that directory.
>
>
> Accessing HTML pages works fine. CGI scripts that just generate HTML
> work fine.
>
>
> However when I try to get access to CSS and JS files the apache error
> log keeps showing me the dreaded 403 error message
>
>
> I have added the following line into httpd.conf
>
> Alias /jslib "C:/apachedata/jslib"
>
>
> Here is the "source code" generated by my CGI script which results in
> the 403 error emssage
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
> xmlns="http://www.w3.org/1999/xhtml" lang="en-US"
> xml:lang="en-US"><head><title>Encrypted Data Management</title><link
> rel="stylesheet" type="text/css" href="/jslib/styles.css
> <view-source:http://127.0.0.1/jslib/styles.css>" /><link
> rel="stylesheet" type="text/css" href="/jslib/fieldset.css
> <view-source:http://127.0.0.1/jslib/fieldset.css>" /><script
> src="/jslib/check_all_fields.js
> <view-source:http://127.0.0.1/jslib/check_all_fields.js>"
> type="text/JAVASCRIPT"></script><script
> src="/jslib/hide_show_divider.js
> <view-source:http://127.0.0.1/jslib/hide_show_divider.js>"
> type="text/JAVASCRIPT"></script><meta http-equiv="Content-Type"
> content="text/html; charset=iso-8859-1" /></head><body><h1>Encrypted
> Data Management</h1><H4>CGI script parameters</H4><H4>No CGI script
> parameters are defined</H4><BR><H3>Sun Sep 6 13:50:40 2015</H3><OL
> style="line-height: 35px;"><LI><A HREF="e2.cgi?function=listall
> <view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=listall>">List
> Data</LI><LI><A HREF="e2.cgi?function=query
> <view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=query>">Query
> Data</LI><LI><A HREF="e2.cgi?function=add
> <view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=add>">Add New
> Record</LI><LI><A HREF="e2.cgi?function=meta
> <view-source:http://127.0.0.1/cgi-bin/e2.cgi?function=meta>">List
> Metadata</LI></LI></OL></body></html> Here is the contents of the
> jslib directory Volume in drive C is TI10673200G Volume Serial Number
> is 5E9D-3D3F Directory of C:\apachedata\jslib 09/06/2015 01:04 PM
> <DIR> . 09/06/2015 01:04 PM <DIR> .. 09/06/2015 01:04 PM 1,396
> check_all_fields.js 09/06/2015 11:32 AM 3,294 fieldset.css 09/06/2015
> 01:04 PM 1,515 hide_show_divider.js 09/06/2015 11:32 AM 5,929
> styles.css 4 File(s) 12,134 bytes 2 Dir(s) 591,461,138,432 bytes free
> Here is the tail end of "access.log" 127.0.0.1 - -
> [06/Sep/2015:13:53:13 -0400] "GET /jslib/fieldset.css HTTP/1.1" 403
> 220 127.0.0.1 - - [06/Sep/2015:13:53:13 -0400] "GET
> /jslib/hide_show_divider.js HTTP/1.1" 403 228 127.0.0.1 - -
> [06/Sep/2015:13:53:13 -0400] "GET /jslib/check_all_fields.js HTTP/1.1"
> 403 227 127.0.0.1 - - [06/Sep/2015:13:53:13 -0400] "GET
> /jslib/styles.css HTTP/1.1" 403 218 Any ideas ? What else do I need to
> do or change to properly access my CCS and JS files ?
[users@httpd] Re: Can't get access to CSS stylesheets and javascript files using
Apache2.2 on windows
Posted by Good Guy <xf...@hotmail.com>.
On 06/09/15 19:08, barry kimelman wrote:
> Hello,
>
>
> I have installed apache2.2 on my windows laptop.
>
>
> The basics are working fine. I setup my own directory structure under
> "C:\apachedata" and modified httpd.conf to point under that directory.
>
>
Did you do it like this:
DocumentRoot "c:/apachedata"
You also need to insert this after it:
<Directory "c:/apachedata">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org