homepage Welcome to WebmasterWorld Guest from 54.227.56.174
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
apache 2 and mod_rewrite
Problems with Apache 2 and mod_rewrite
happyuser




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

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!

 

jdMorgan




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

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

happyuser




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

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?

jdMorgan




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved