Mod Rewrite

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I got a totally dynamic website, and to improve my search engine  
results, I would like to use mod rewrite.

 From what I've understood so far, I have to put the necesarry lines
into my htacess file, right?

Anyway, I read some tutorials, but I can't quite grasp how to
do it in my case -

I have an url like that:
and I want it rewritten to:

How can I get this done?



Re: Mod Rewrite

In the case you've described, your rewrite-rule would look something
like this (not tested):

RewriteRule ^/(*)$ /index.php?page=$1

In other words, in the original URL match everything after the / and
call it $1.  Then in your re-written URL you just use the $1 to
represent the pattern that was matched.

Re: Mod Rewrite

I just realized - that is only my page variable -
but what happens with the other variables I am using sometimes?

u can't rewrite it to an url like

Can you?

Or should it be something like

Or how should it be done the best way possible for search engines?



ZeldorBlat schrieb:
Quoted text here. Click to load it

Re: Mod Rewrite

Stefan Reiter wrote:
Quoted text here. Click to load it

And your PHP question is?????

P.S. Please don't top post.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Mod Rewrite

Stefan Reiter wrote:
Quoted text here. Click to load it

heres what i use
RewriteEngine On
RewriteCond % !-f
RewriteCond % !-d
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]

It checks if the url is a dir or a file & then it rewrites it with the
extra querystring.
good luck

Re: mod rewrite

Jon Slaughter wrote:

Quoted text here. Click to load it

RewriteRule ^(case1|case2|case3)[/]$ /Index.php\?$1/Main.php

Toby A Inkster BSc (Hons) ARCS
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

Site Timeline