This is a discussion on Apache 2 on Windows XP within the Apache Web Server forums, part of the Web Server and Related Forums category; > If I understand the issue properly, this does display the proper page, but with broken links. > Are there ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
> If I understand the issue properly, this does display the proper page, but
with broken links. > Are there any other rewriterule applied ANYWHERE in the server or vhost config or this .htaccess? You are exactly right. The page is displayed with no styling and no images. The php code is properly executed (i display the parameter value). There are no other rewrites on the server. This is my only dev-site which uses the htaccess. > To further investicate, I need to know the setting of your DocumentRoot, > the local path of a css, both the working and failing link to that css and its referer - http://localhost/mywebsite/param1 or http://localhost/mywebsite/param1-. My DocumentRoot in httpd.conf file: DocumentRoot "D:/Pliki/StronyWWW" Local path of the css: D:\Pliki\StronyWWW\mywebsite\styles.css Local path to images: D:\Pliki\StronyWWW\mywebsite\gfx\ URL to css: http://localhost/mywebsite/styles.css URL to images: http://localhost/mywebsite/gfx/ Once again the content of my htaccess.txt file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /mywebsite/index.php [L,NS] |
|
|||
|
once again, you are only getting this issue because the images and css
dont exist relative to the file you asking to control them. I you used absolute urls this wouldnt happen. you need to make sure that the links to images and css and javascript etc.. are actually valid and not pointing to the wrong place. If you DONT do this you still can make things work, but only if your script knows where they are. you /might/ be able to modify your htaccess to RewriteRule (.*)/$ /mywebsite/index.php/$1 [L,NS] but you really do need to think about the structure of the site now that you are asking for a controller script to do the work. My advice would be to turn off rewritelog and set it to 9 and watch what the server is trying to actually find and what is now matching, and the sheer work its having to do. My advice is to change the links to absolute paths so that the server doesnt have to rewrite requests for images and css etc.. which cuts down the work and hence the time take to server the page significantly as well as allowing all the rest of the things to happen as expected - caching/last modifed/etagging etc...) |
|
|||
|
"Byru" <byru@gazeta.pl> schreef in bericht
news:ekpbmj$mvn$1@inews.gazeta.pl... > My DocumentRoot in httpd.conf file: > DocumentRoot "D:/Pliki/StronyWWW" > Local path of the css: > D:\Pliki\StronyWWW\mywebsite\styles.css > Local path to images: > D:\Pliki\StronyWWW\mywebsite\gfx\ > > URL to css: > http://localhost/mywebsite/styles.css So when requested without trailing slash http://localhost/mywebsite/param1/ your css linking looks like '<link rel="stylesheet" type="text/css" href="http://localhost/mywebsite/styles.css">' How does this line looks like after requesting WITH trailing slash http://localhost/mywebsite/param1/ ? HansH |
|
|||
|
its more simple than that i think,
take any webpage found randomly on google, I just searched for "php script" and randomly clicked on a link http://www.thesitewizard.com/archive/feedbackphp.shtml now add a trailing slash: http://www.thesitewizard.com/archive/feedbackphp.shtml/ all the images script, everything goes away. why? take a look at the html source and youll see they use relative links. the css file for instnace comes from .../include/common.css now http://www.thesitewizard.com/archive...ude/common.css exists but http://www.thesitewizard.com/archive...ude/common.css doent any file or directory that exists isnt touched by his rewrite, but things which dont exist are rewritten. However his script doesnt then request the correct file, so he either needs to adjust his script, the css links, or the rewrite to never add the trailing slash even when someone types into the URL by hand, or he "prefers" to use it. |
|
|||
|
> So when requested without trailing slash
> http://localhost/mywebsite/param1/ your css linking looks like > '<link rel="stylesheet" type="text/css" > href="http://localhost/mywebsite/styles.css">' > > How does this line looks like after requesting WITH trailing slash > http://localhost/mywebsite/param1/ ? http://localhost/mywebsite/bank/ <link rel="stylesheet" href="styles.css" type="text/css"> Looks like this but because the styles.css file doesn't exist in the /bank/ path (there is no such directory) the css ins displayed :(I would like to avoid absolute paths, can it be fixed?tia Byru |
|
|||
|
"Byru" <byru@gazeta.pl> schreef in bericht
news:eks82b$baq$1@inews.gazeta.pl... >> So when requested without trailing slash >> http://localhost/mywebsite/param1/ your css linking looks like >> '<link rel="stylesheet" type="text/css" >> href="http://localhost/mywebsite/styles.css">' >> >> How does this line looks like after requesting WITH trailing slash >> http://localhost/mywebsite/param1/ ? > > http://localhost/mywebsite/bank/ > <link rel="stylesheet" href="styles.css" type="text/css"> Looks like this > but because the styles.css file doesn't exist in the /bank/ path (there is > no such directory) the css ins displayed :(I would like to avoid absolute > paths, can it be fixed?tia Byru Recently in another thread discribing a another trailing slash problem I wrote " Wonder whether 'UseCanonicalName = off' may solve that http://httpd.apache.org/docs/2.0/mod...ecanonicalname " Feedback then reported 'problem solved', so try your luck HansH |