Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: Ocean10000 & incrediBILL & phranque

apache 2 and mod_rewrite

Problems with Apache 2 and mod_rewrite

   
11:41 pm on Jan 16, 2004 (gmt 0)

10+ Year Member



Hello!

I just got installed apache 2 and now i try to make my news system work with mod_rewrite.

But everytime i type file.html -> it comes only 404 (file not found) instead of file.php

i have many files in the same folder which are php files and i want the user type file.html but get a php executed: e.x. you type news293.html -> get news.php?news=293 Or simply dslnews.html -> dslnews.php

i have my .htaccess where all my files are:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteRule ^dslnews\.html$ dslnews.php [L]
RewriteRule ^dsltarife\.html$ dsltarife.php [L]
RewriteRule ^rdf\.rdf$ rdf.php [L]
RewriteRule ^volumentarife\.html$ volumentarife.php [L]
RewriteRule ^zeittarife\.html$ zeittarife.php [L]
RewriteRule ^flattarife\.html$ flattarife.php [L]
RewriteRule ^index\.html$ index.php [L]
RewriteRule ^newsticker\.html$ nticker.html [L]
RewriteRule ^news([0-9]{4}-[0-9]{2}-[0-9]{2})\.html$ news.php?news=$1 [L]
RewriteRule ^provider([0-9]{4}-[0-9]{2}-[0-9]{2})\.html$ provider.php?provider=$1 [L]
RewriteRule ^volumentarife_detail([0-9]{4}-[0-9]{2}-[0-9]{2})\.html$ volumentarife_detail.php?tarif=$1 [L]
RewriteRule ^zeittarife_detail([0-9]{4}-[0-9]{2}-[0-9]{2})\.html$ zeittarife_detail.php?tarif=$1 [L]
RewriteRule ^flattarife_detail([0-9]{4}-[0-9]{2}-[0-9]{2})\.html$ flattarife_detail.php?tarif=$1 [L]
RewriteRule ^archiv([0-9]{4}-[0-9]{2}-[0-9]{2})\.html$ archiv.php?kat=$1 [L]

RedirectMatch ^/forum/forumdisplay/f-([a-zA-Z0-9_-]*).html$ /forum/archive/index.php/f-$1 [L]
RedirectMatch ^/forum/showthread/t-([a-zA-Z0-9_-]*).html$ /forum/archive/index.php/t-$1 [L]

and my httpd.conf

# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

Please help me!

THANKS!

2:23 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



happyuser,

Welcome to WebmasterWorld [webmasterworld.com]!

You will not be able to use mod_rewrite with AllowOverride set to "None". I suggest you set it to "All" and then remove overrides until you have problems.

You will need at least AllowOverride FileInfo Options to use your code as posted.

See the Apache documentation of AllowOverride [httpd.apache.org] for more information.

Jim

9:27 am on Jan 17, 2004 (gmt 0)

10+ Year Member



I have already tries with AllowOverride All - but it comes still the 404 file not found error.

Is my .htaccess correct for what i want to do?

6:09 pm on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



happyuser,

You code looks OK to me. I usually recommend putting a slash ahead of the substitution URL, for example:


RewriteRule ^dslnews\.html$ /dslnews.php [L]

but I think your problem is probably with the server config, not your code.

Jim

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month