.htaccess are not working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

.htaccess are not working

Postby GetFree » 18. October 2006 05:02

WinXP SP2
Apache/2.2.0 (Win32)


The htaccess file in my public_html is not working.
-------------------------------------------------------
ServerSignature Off
DefaultType application/x-httpd-php

php_flag expose_php off

RedirectMatch 404 \.php$
--------------------------------------------------------

on httpd.conf I put:
AllowOverride All


Any idea what would be the problem???

thanks in advance.
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby Izzy » 18. October 2006 05:07

Any clues in your apache error log?
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby GetFree » 18. October 2006 06:39

No, nothing.

It's like the .htaccess file doesn't existe at all.
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby Izzy » 18. October 2006 07:03

ServerSignature Off
won't work on custom error pages which is what you have in the default XAMPP installation.

This from \extra\httpd-default.conf
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature On


The error messages are contained within xampp\apache\error directory and are in various languages.

You can turn custom error messages off in the httpd.conf file by commenting out this line:
# Multi-language error messages
Include conf/extra/httpd-multilang-errordoc.conf

To:
# Multi-language error messages
# Include conf/extra/httpd-multilang-errordoc.conf

or comment out the entries in the conf file it refers to.

You should now be able to control the Apache default error messages using your .htaccess file although I have not tested your .htaccess file to see if it all works.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby GetFree » 18. October 2006 21:41

I deleted everything and I left just this line:

RedirectMatch 404 \.php$


which means any request for a php file should get a 404 responce.

but it doesn't work at all.

I dont know what's happening. The error log doesn't show anything unusual.
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby Izzy » 19. October 2006 01:19

GetFree wrote:I deleted everything and I left just this line:

RedirectMatch 404 \.php$


which means any request for a php file should get a 404 responce.

but it doesn't work at all.

I dont know what's happening. The error log doesn't show anything unusual.

Thats really strange as it works for me when I put the above in a .htaccess file in my htdocs directory. I get an error message as expected. I also tried it in all of my vhosts domain's root directories with success in all cases.
The path to my vhosts is xampp\home\[username]\public_html

The htaccess file in my public_html is not working.


As a test try putting the above line in the .htaccess file in xampp\htdocs\xampp directory like I tested it with above and go to http://localhost and see if your .htaccess works as it should.

RedirectMatch uses the mod_alias module.
Check in your xampp\apache\conf\httpd.conf file that the module is not commented out, it should look like this:
LoadModule alias_module modules/mod_alias.so
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby GetFree » 19. October 2006 02:15

How weird.
I put the .htaccess file in my xampplite\htdocs directory and it worked flawlessly.

But it doesn't work on my other virtual host.

I'm gonna cry :cry:

What could be the problem??
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby Izzy » 19. October 2006 02:25

GetFree wrote:How weird.
I put the .htaccess file in my xampplite\htdocs directory and it worked flawlessly.

But it doesn't work on my other virtual host.

I'm gonna cry :cry:

What could be the problem??


Thats what I thought and why I asked you to do the test. It is obviously not the .htaccess file more likely a vhosts file issue.
Paste the vhost file or the container that is making you cry. :)
You can obfuscate any sensitive info you dont want on the forum as long as the containers are intact.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby GetFree » 19. October 2006 02:48

This is it:


<VirtualHost *:80>
ServerName myVHost
ServerAlias myVHost*
DocumentRoot "D:/myVHost/www"

</VirtualHost>
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby Izzy » 19. October 2006 02:53

GetFree wrote:This is it:


<VirtualHost *:80>
ServerName myVHost
ServerAlias myVHost*
DocumentRoot "D:/myVHost/www"

</VirtualHost>


Try this:
Code: Select all
<VirtualHost *:80>
ServerName myVHost
ServerAlias myVHost*
DocumentRoot "D:/myVHost/www"
<Directory "D:/myVHost/www" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby GetFree » 19. October 2006 03:30

Damn it...

That did the trick

Thank you, Izzy.

Would you help me with a mod_rewrite problem I have??

I want to strip out the .php extencion of all my URLs without renaming the .php files.

I tried using:
RewriteRule /[^/\.]+$ %{REQUEST_FILENAME}.php

but I havn't been successfull.
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby Izzy » 19. October 2006 03:44

GetFree wrote:Damn it...

That did the trick

Thank you, Izzy.

Would you help me with a mod_rewrite problem I have??

I want to strip out the .php extencion of all my URLs without renaming the .php files.

I tried using:
RewriteRule /[^/\.]+$ %{REQUEST_FILENAME}.php

but I havn't been successfull.

Did you uncomment the mod_rewrite module in the httpd.conf file?
It is commented by default.

Turn it on:
RewriteEngine on
RewriteBase /
RewriteRule /[^/\.]+$ %{REQUEST_FILENAME}.php

Your rule is regex so that is what you will need to check. Me not too clever with regex ;)
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby GetFree » 19. October 2006 03:50

Yes, I uncommented it.
I did it after you told me about mod_alias could be commented
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby GetFree » 19. October 2006 04:48

does xampp lite support mod_rewrite??

I did a test on my webhosting server and it works fine
But on my local web server it doesn't

any idea??
GetFree
 
Posts: 19
Joined: 18. October 2006 04:55

Postby underdone » 19. October 2006 05:23

It supports mod rewrite. Edit your httpd.conf and remove the # from in front of LoadModule rewrite_module modules/mod_rewrite.so

Then restart the server and it should be working.
User avatar
underdone
 
Posts: 34
Joined: 15. October 2006 04:56
Location: Albuquerque, NM

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 102 guests