mod_rewrite doesn't work?

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

mod_rewrite doesn't work?

Postby styra01 » 18. December 2011 14:55

Hi,
I bought a CMS Design Using PHP and jQuery book to learn something new. In the first pages of book, there is a mod_rewrite code in .htaccess, and looks like this:
Code: Select all
RewriteEngine on
RewriteRule ^([^./]{3}[^.]*)$ /index.php?page=$1 [QSA,L]

Typing localhost/cms/MYWORD in browser doesn't work (404 not found)... When i upload this .htaccess & other cms files on my hosting - everything works fine.
How to set XAMPP mod_rewrite to work properly?
styra01
 
Posts: 1
Joined: 18. December 2011 14:49
Operating System: Windows 7

Re: mod_rewrite doesn't work?

Postby Sharley » 18. December 2011 23:17

Read the \xampp\apache\logs\error.log file for clues about the 404 file not found error.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: mod_rewrite doesn't work?

Postby Kiseki » 10. January 2012 22:28

Hi,

I am having the same problem, did you manage to figure out what the issue was?

I get the following error in the Apache log;

"script 'C:/****/*****/******/******/Test Server/index.php' not found or unable to stat"

Thanks in advance.
Kiseki
 
Posts: 2
Joined: 10. January 2012 22:22
Operating System: Win7 X64

Re: mod_rewrite doesn't work?

Postby Kiseki » 10. January 2012 22:34

I just solved the issue by doing the following;

"Rewriting in Virtual Hosts

By default, mod_rewrite configuration settings from the main server context are not inherited by virtual hosts. To make the main server settings apply to virtual hosts, you must place the following directives in each <VirtualHost> section:


RewriteEngine On
RewriteOptions Inherit
"
Kiseki
 
Posts: 2
Joined: 10. January 2012 22:22
Operating System: Win7 X64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 38 guests