Forum Moderators: phranque

Message Too Old, No Replies

rewriteEngine fails

rewrite engine never works

         

8thperson

2:08 pm on Mar 21, 2009 (gmt 0)

10+ Year Member



Hi every buddy...
i am Asif, a php developer, a little more then beginner. i have just jumped into apache's url rewrite and mod rewrite methods. but since first day, i m facing just "failures". i don't know why is it happening. I have tried different tutorials, in office pc, home pc, online linux/windows server and on my local machine, everwhere.

i always get either of two errors.
1.) internal server problem
2.) page not found

all i do is

1.) i make a .htaccess file in the folder where i want redirection (here: [localhost...] )
2.) put the required code in file. for the simplest example. i typed

RewriteEngine on
RewriteRule ^old\.html$ new.html

these two lines. i have new.html file in the .htaccess's folder. but when i type old.html in url. browser excuses to reward me success...

please guide me to get done with it..
thanks frns

wilderness

2:33 pm on Mar 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This may be more than you desire, however the preliminary steps may be useful. (I would suggested reading the entire thread before progressing)

[webmasterworld.com...]

eeek

1:35 am on Mar 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule ^old\.html$ new.html

Try it with the ^ and see if it works.

g1smd

8:41 am on Mar 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your code is for a rewrite, not for a redirect. It is possible you have a 'loop' if the new pointer matches the pattern for the old URL.

End every rule with [L] to avoid problems.

Make sure you escape literal periods in the pattern on the left.

If you want a redirect here, you also add the full domain name to the target URL, and [R=301,L] to the end.

8thperson

11:31 am on Mar 24, 2009 (gmt 0)

10+ Year Member



yes now it works but only when i Manually start rewrite_module from apache menu inside WAMP icon in taskbar.
but what when rewrite module is not on by default on any server... :(
because

RewriteEngine on

doesn't work n 500 internal server error appears

8thperson

11:56 am on Mar 24, 2009 (gmt 0)

10+ Year Member



*yeaaah*
it works now :)
thankx all bros :)

g1smd

6:12 pm on Mar 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What was the final code you used?