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; Hey, I just instaled Apache 2 and PHP 5 on my XP SP2 machine. Is there a chance to enable ....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hey,
I just instaled Apache 2 and PHP 5 on my XP SP2 machine. Is there a chance to enable .htaccess files functionality on this config? If yes, please explain which settings in conf file of apache do i have to modify and to which values. I googled for it today but didnt find a working solution. TiA -- Byru http://colsel.blitz-art.com |
|
|||
|
at the moment AllowOverride is set to None in every directory root and
up so search for it and change it to AllowOverride All that will allow you to use .htaccess files. Now the issue is creating them, just make sure that when you save the ..htaccess you set the file type to All Files *.* then windows will allow you to save with the dot at the front. If you have a file called htaccess which you configure and then want to rename to .htaccess you cant do that in explorer, you have to open and save as using the trick above. you know though that it slows apache down, to proove that just get filemon from sysinternals and watch apache searching and searching instead of serving! better to use <directory> blocks in the various conf files unless you want a direct copy to dev on. |
|
|||
|
> so search for it and change it to
> > AllowOverride All > Ha, the thing is that this doesnt work. I changed it, restarted apache and it still does not read (see) my htaccess file(s) and doesnt use them. -- Byru http://colsel.blitz-art.com |
|
|||
|
"Byru" <byru@gazeta.pl> schreef in bericht news:eknk9e$1u8$1@inews.gazeta.pl... > I just instaled Apache 2 and PHP 5 on my XP SP2 machine. > > Is there a chance to enable .htaccess files functionality on this config? Your reading [should have] started here http://httpd.apache.org/docs/2.0/mod...accessfilename http://httpd.apache.org/docs/2.0/mod...#allowoverride Note: Many editors on Windows take .htaccess as a nameless file only having an extention and are unwilling to create it. In such case just name it in a way your editor likes and thereafter rename it to get apache going HansH |
|
|||
|
Użytkownik "HansH" <hansh@invalid.invalid> napisał w wiadomości news:456f6f76$0$334$e4fe514c@news.xs4all.nl... > > "Byru" <byru@gazeta.pl> schreef in bericht > news:eknk9e$1u8$1@inews.gazeta.pl... >> I just instaled Apache 2 and PHP 5 on my XP SP2 machine. Ok, it just started working. I changed the .htaccess file name to htaccess.txt in apache conf file. However my page doesn't display css and images now. The content of the htaccess.txt file is: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /mywebsite/index.php [L,NS] My website is located in the /mywebsite/ DIR in the apache document root. The htaccess.txt file is located just in this /mywebsite/ DIR. How can i fix it so the graphics are displayed? When i look at the source of the page all links are correct (to css and images). TiA Byru |
|
|||
|
> RewriteEngine On > RewriteBase / > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > RewriteRule . /mywebsite/index.php [L,NS] Ah, i just discovered. This link works fine (displays graphics and css): http://localhost/mywebsite/param1 But this doesn't display gfx and css: http://localhost/mywebsite/param1/ How to fix it so the link with ending slash works as well? (i prefer such links). Byru |
|
|||
|
thats a word press kind of setup,
you can also use this kind of thing. ErrorDocument 404 / Options -Indexes RewriteEngine On RewriteBase /tmp/blah RewriteRule ^$ index.php/ [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php/$1 [QSA,L] might work for you, you seem to problems with the conf that I wouldnt expect to see (having to rename to htaccess.txt) |
|
|||
|
Uzytkownik "shimmyshack" <matt.farey@gmail.com> napisal w wiadomosci news:1164971789.266385.177000@80g2000cwy.googlegro ups.com... > thats a word press kind of setup, > > you can also use this kind of thing. > > ErrorDocument 404 / > Options -Indexes > RewriteEngine On > RewriteBase /tmp/blah > RewriteRule ^$ index.php/ [L] > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > RewriteRule (.*) index.php/$1 [QSA,L] Hmm. tried this but the website is not displayed at all. I changed the blah path naturally. Can you just add the trailing slashes override to the following somehow? i mean that all links without a slash (/) on the end will be rewritten to have the slash and additionally the base functionality will be preserved. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /mywebsite/index.php [L,NS] Byru |
|
|||
|
"Byru" <byru@gazeta.pl> schreef in bericht
news:ekoplj$ebe$1@inews.gazeta.pl... > Użytkownik "HansH" <hansh@invalid.invalid> napisał w wiadomości > news:456f6f76$0$334$e4fe514c@news.xs4all.nl... >> >> "Byru" <byru@gazeta.pl> schreef in bericht >> news:eknk9e$1u8$1@inews.gazeta.pl... >>> I just instaled Apache 2 and PHP 5 on my XP SP2 machine. > Ok, it just started working. I changed the .htaccess file name to > htaccess.txt in apache conf file. The renamed .htaccess will backfire as soon as your Windows-hosted site is replicated to a -eg your providers- Linux based host > However my page doesn't display css and images now. The content of the > htaccess.txt file is: > > RewriteEngine On > RewriteBase / > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > RewriteRule . /mywebsite/index.php [L,NS] At first sight it is odd to see a single script that handles ALL types of files. However, it apperently does as you stated < This link works fine (displays graphics and css): < http://localhost/mywebsite/param1 < But this doesn't display gfx and css: < http://localhost/mywebsite/param1/ 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? > My website is located in the /mywebsite/ DIR in the apache document root. > The htaccess.txt file is located just in this /mywebsite/ DIR. How can i > fix it so the graphics are displayed? 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-. HansH |
|
|||
|
i bet the reason you are not having any luck with linked files is
because they are referenced relatively. src="../images/image.jpg" rather than absolutely src="/path/to/timages/image.jpg" you can alter your script so that it understnads the context of the file that was sent to it for control, or alter the rewrite rule. (but without knowing more about your setup I wont guess) I use absolute links for all includes, (absolute that it relative to the doc root within html) so I can use model view control scripts and never care about where the file came from, just what was the requested URI and serve it, knowing all links will work. It has always seemed to me infinitely better to use absolute links, but some people like to "make their websites moveable" for some reason - put onto CD perhaps. |