Apache mod rewrite

I’m not good with apache mod rewrite and a friend needs a help for his site. I took the files from him but on the localhost works only index.php. All files that are in pages folder shows up in url with only the name withouth .php. I can’t do anything because I have too many files and I can’t open those files to see how to help my friend.
On a file I found where the rewrite rules.
Can someone tell me how to work on localhost with this or how to modify those rules to work on local host?


 RewriteRule ^/phpmyadmin/?$ http://example.com/phpmyadmin [R=301,L]
  RewriteCond %{HTTP_HOST} ^www\\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1$1 [R=301,L] 
  RewriteRule ^/file/([\\d]+\\.[\\w]+)/?$ /files.php?a=$1 [L]
  RewriteRule ^/([\\w\\d_]+)/?(([\\w\\d]+)/?(([\\w\\d]+)/?(([\\w\\d]+)/?(([\\w\\d]+)/?)?)?)?)?$ /pages/$1.php?a=$3&b=$5&c=$7&d=$9 [L] 

Thank you DK. Nice tutorial. I will read it again to understand how to do the RewriteRules for that website.

sorin,

Oh, my, this code is specifically for use with Apache 1.x. If you’re using 2.x, remove the / after the ^.

$n (where n=1 … n=9) is the Apache variable you created in your RewriteRule’s regex with each succeeding parenthetical (). In your case, they will be either d’s or w’s or _'s.

Have a read of the tutorial article linked in my signature for more information about regex and mod_rewrite in general (including example code).

Regards,

DK

At least someone please tell me what means this

a=$3&b=$5&c=$7&d=$9

that is in the end

Thank you. If you have any questions, you know where to find me. :wink:

Regards,

DK