Problems with Rewrite Engine

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

Problems with Rewrite Engine

Postby Magnus » 07. September 2004 09:57

Greetings

I'm having some problems with the Rewrite Engine. The engine is on and works on some of the pages, but when it comes to pages that are getting one article from the database things begin to go wrong as I get an 404 error message, stating "The requested URL /news_show.php was not found on this server.". In other words:

(Please notice that I'm using this on a local machine)

Things work fine when I use this link:

http://localhost/tradisjoner/news.html
(the same as: http://localhost/tradisjoner/news.php)

But when I wish to use this one then thing go wrong:

http://localhost/tradisjoner/nyhet107.html
(the same as: http://localhost/tradisjoner/news_show.php?id=107)

My .htaccess files has this:

RewriteEngine on
RewriteRule ^text([0-9]+)\.html$ /articles_show.php?id=$1
RewriteRule ^categories([0-9]+)\.html$ /categories.php?category_no=$1
RewriteRule ^oppskrift([0-9]+)\.html$ /contents.php?id=$1
RewriteRule ^print([0-9]+)\.html$ /printer.php?id=$1
RewriteRule ^review([0-9]+)\.html$ /review.php?rev_id=$1
RewriteRule ^nyhet([0-9]+)\.html$ /news_show.php?id=$1
RewriteRule ^links_cat([0-9]+).html$ /links.php?licat_id=$1
RewriteRule ^links_add.html$ /links.html?action=add
RewriteRule ^go([0-9]+).html$ /links.html?go=$1
RewriteRule (.*)\.html $1.php [L]

And all of it is working just fine on the web at: http://tradisjoner.no

Could I be missing something in the httpd.con file? The only line I changed was:

from

#LoadModule rewrite_module modules/mod_rewrite.so

to

LoadModule rewrite_module modules/mod_rewrite.so

Should I have done more changes?

Looking forward to your answers.
Magnus
 
Posts: 2
Joined: 07. September 2004 09:41
Location: Oslo, Norway

Problem solved

Postby Magnus » 08. September 2004 09:19

I've fixed the error.

The reason for the error was "/" in all the Url rewrite rules, f.ex:

RewriteRule ^nyheter([0-9]+)\.html$ /news.php?offset=$1

should have been:

RewriteRule ^nyheter([0-9]+)\.html$ news.php?offset=$1

I'm not sure how this will work on the Web, but it works on my localserver.

Always nice to spend hours finding out as simple things as that :evil:
Magnus
 
Posts: 2
Joined: 07. September 2004 09:41
Location: Oslo, Norway


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 141 guests