Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I am working in Windows XP using wamp server. I want to use the .htaccess file to manipulate the URL.
I enabled the rewrite_module from the Apachi Module List. Then I put the .htaccess file in root directory.

My .htaccess file contains

RewriteEngine On 
RewriteRule ^movies/([A-Za-z0-9-]+)/?$ movies.php?moviename=$1 [NC,L]



But after doing all this. There is no effect on my web pages. They are working the same as earlier. No Error, No Difference.

I can't understand why .htaccess is not working.

Can any one explain??
Posted

I just checked on my own machine with your re-write rule and it seems to be working. I tried with this URL (my localhost) :

PHP
http://.../SlidingPanel/movies/sgsfgsfs


and it was able to forward me to the movies.php page as you would expect. Can you share the URL that's not working? Also, confirm that you have enabled the rewrite_module on Apache server and also check your httpd.conf file to make sure that there is no "#" i.e. commented at the beginning of this line :

PHP
LoadModule rewrite_module modules/mod_rewrite.so


It might seem a little weird, but the ".htaccess" should not have anything before the ".", htaccess is not an extension but a filename in itself. Please make sure thats the case.

Finally, when all is in place, restart the Apache server...Let us know if it worked.

Cheers...

EDIT: have a look at the Apache error logs as well, if it still doesn't work.
 
Share this answer
 
v2
Comments
rashidfarooq 14-Oct-11 4:43am    
According to your instructions i made sure that

the file name is exactly ".htaccess"
LoadModule rewrite_module modules/mod_rewrite.so has no comments sign "#" etc before.

The URL of my webpage is

http://localhost/mysite/movies.php?moviename=etc
but i want to change this as
http://localhost/mysite/movies/etc.html

I have place the .htaccess file in my root directory.
But this does not effect my webpage. Even it does not give any error. And my wepage is working as earlier.
What can be the problem??
i think your RegEx i.e. RewriteRule is working exactly opposite to the way you want it to work. You may have to rearrange and also correct the Regex like so:

PHP
^movies\.php\?moviename=(.*) movies/$1\.html [NC,L]


try this and let me know...

EDIT: corrected a silly mistake, the "?" needs to be escaped too. Done!

Cheers...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900