New to rewrite and it is overwhelming

New to mod_rewrite? This is a good place to start.

New to rewrite and it is overwhelming

Postby kris7845 » Sun Mar 09, 2008 12:47 pm

Hello, I believe i have a pretty simple rewrite that I need but I cannot make heads or tails of this stuff. I have read the tuts made by Mad and it makes sense but no matter what I try I get a 500 server error.

In a nutshell I have a dynamic site, it's a single file page that loads up a table of contents, data, images, etc etc. and each link on the toc points to

index01.html
index02.html
etc etc

I would like the url to be rewritten so it is processed like

index.html?id=01
index.html?id=02

but showing up in the url as the original link.

Normally I would just keep is in php and pass the variables normally but when the page is finished i plan to crawl the site and save a static copy for offline (with no pre processor) browsing.

I hope I gave enough information to give an idea of what I am trying to do and here is a copy of the last rewrite I tried but remember this is my first time trying rewrites so dont laugh too hard ;)



Code: Select all
rewriteRule ^index([0-9]+)\.html$ /index\.html\?id\=$1 / [QSA]
kris7845
 
Posts: 3
Joined: Sun Mar 09, 2008 12:34 pm

Postby richardk » Mon Mar 10, 2008 4:04 pm

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^index([0-9]+)\.html$ /index.html?id=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kris7845 » Tue Mar 11, 2008 1:06 pm

Thanks richard, I did try that and all I get is some page saying "It Works!" which I have no idea where it comes from, I am just gonna assume my mod_rewrite is messed up
kris7845
 
Posts: 3
Joined: Sun Mar 09, 2008 12:34 pm

Postby richardk » Thu Mar 13, 2008 1:20 pm

What happens if you change /index.html to a different file?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 12 guests

cron