Page 1 of 1

Problem With Mod_Rewrite

Posted: Sun Aug 24, 2003 4:43 am
by leebo
Hi

I'm having big trouble setting up my pages to use mod_rewrite.

In my .htaccess I have the following.

RewriteEngine On
RewriteRule /index/([0-9]+)/.html$ /index.php?ref=$1

I`m wanting index.php?ref=1029

look like

index/1029.html

Can anybody help me ?

Thanks

Posted: Sun Aug 24, 2003 6:37 am
by volka
first you need to quote the dot with a \ not a /
Then, if it is in your .htaccess of the document root, it already matched the <directory / > directive. Only the remaining path is taken into consideration.
so, if e.g. the url is http://my.serv.er/index/12345.html only index/12345.html 'reaches' the rewrite rule.
try

Code: Select all

RewriteRule ^index/(&#1111;0-9]+)\.html$ /index.php?ref=$1
instead.


Also note that you must have override privileges for FileInfo in order to create a new rewrite rule

Posted: Wed Sep 03, 2003 11:14 am
by leebo
Hi

Thanks for that I have got it working at last using the following code:

RewriteEngine On
RewriteRule ^(.*)\.html$ /page.php?page_name=$1

so...

so the link page1.html would be the same as page.php?page_name=page1

That works fine but have now got another problem

another link on my site like home.html or links.html does page.php?page_name=home etc...

How can I have some html links goto to the rewrite and some not ?