PDA

View Full Version : Problem about Mod_rewrite


gop373
11-22-05, 09:48 PM
I have question about install mod_rewrite. I used php and Apache and run locally on window xp. My question is that I install Apache_2.0.55-win32-x86-no_ssl I read from most tutorial it said

Uncomment LoadModule rewrite_module modules/mod_rewrite.so and AddModule mod_rewrite.c. The problem is when I open httpd.cofg, I don't have AddModule mod_rewrite.c. so what should I do....I tried to add AddModule mod_rewrite.c. But that cause server can not run.

What should I do any comment.

2) My second question is ......I created the .htaccess file in this path C:\Program Files\Apache Group\Apache2\htdocs\.htaccess is it the right place ??? My actual project is in this path C:\Test\Asm\mark.php.

in .htaccess i wrote
RewriteEngine on
RewriteRule ^Asm/mark/([0-9]+)$ /Asm/mark.php?GroupID=$1 [L]
Then I restarted Apache.......But the problem is when I open file php.....it still shows http://localhost/Asm/mark.php?ID=1

Do I miss anything.....what should I do any comment !!! :( :confused:

End User
11-24-05, 12:15 PM
Have you edited the code in the script to produce the custom URLs that htaccess can recognize? In general, using .htaccess by itself to rewrite URLs requires that the underlying code be changed as well.

Kobra
03-03-06, 12:41 PM
I just found out rewritten urls (e.g.: /action/x to ?action=x) destroy $_GET variables (and $_POST too probably), junk it...

Kobra
03-03-06, 04:50 PM
plz neverming my last post, i was making some silly mistakes in my code

jordie
03-04-06, 04:55 AM
@Kobra: You are right in a way. Depends on the server setup, some don't pass on those variables. I develop software that uses mod_rewrite so I've had experience with hundreds of servers, very few have this problem, but it is a possibility.

@gop373: Perhaps you didn't grab a full version or something. Mine has: LoadModule rewrite_module modules/mod_rewrite.so and AddModule mod_rewrite.c in my httpd.conf.

BTW the .htaccess file needs to be in your doc root directory.