Forum Moderators: phranque

Message Too Old, No Replies

Rewrite on the Fly

         

mjasra23

5:08 pm on Jul 25, 2006 (gmt 0)

10+ Year Member



I have the following URL: http://www.example.com/z_index.php?view=scarves

I want it rewritten to (301): http://www.example.com/z_index-scarves.htm.

Here is what I have in my .htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteRule z_index.php?view=(.*) z_index-view-$1\.htm [R=301, I]
RewriteRule z_index-view-(.*)\.htm$ z_index.php?view=$1 [I,O,L]

I get a 500 server error when I try this configuration. What am I donig wrong?

Thanks

[edited by: jdMorgan at 11:07 pm (utc) on July 25, 2006]
[edit reason]
[1][edit reason] Example.com [/edit]
[/edit][/1]

mjasra23

6:40 pm on Jul 25, 2006 (gmt 0)

10+ Year Member



The server error goes away when I updated to:

RewriteRule ^z_index.php\?view=(.*)$ http\://www\.example\.com/z_index-view-$1\.htm [R=301]
RewriteRule z_index-view-(.*)\.htm$ z_index.php?view=$1

But the 301 redirect doesn't happen.

[edited by: jdMorgan at 11:07 pm (utc) on July 25, 2006]
[edit reason]
[1][edit reason] Example.com [/edit]
[/edit][/1]

mjasra23

11:07 pm on Jul 25, 2006 (gmt 0)

10+ Year Member




System: The following message was spliced on to this thread from: http://www.webmasterworld.com/apache/3021997.htm [webmasterworld.com] by jdmorgan - 6:09 pm on July 25, 2006 <small>(CDT -5)</small>


My Redirect does not seem to be firing, here's my code in the htaccess

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^z_index.php?view=(.*)$ [www\.example\.com...] [R=301]
RewriteRule z_index-view-(.*)\.htm$ z_index.php?view=$1

I even tried hardcoding the parameters and it didn't work:
RewriteRule ^z_index.php\?view=scarves http\://www\.example\.com/z_index-view-scarves.htm [R=301]

Any help would be much appreciated.

[edited by: jdMorgan at 11:10 pm (utc) on July 25, 2006]
[edit reason]
[1][edit reason] Example.com [/edit]
[/edit][/1]

jdMorgan

11:17 pm on Jul 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See this recent thread [webmasterworld.com].

Also, this one [webmasterworld.com] in our library may be of help.

Jim

[edited by: jdMorgan at 11:18 pm (utc) on July 25, 2006]