Forum Moderators: phranque

Message Too Old, No Replies

mysite.com/index.php?method=Name - to - mysite.com/index.php?FileName

Mod Rewrite

         

classa

10:51 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



I have this URL;

[mysite.com...]

What I would like to be able to do is this;

[mysite.com...]

Basically removing "method="

Using this rule;

RewriteEngine On
#rewrite all old URIs with the method
RewriteRule ^(.*)\.php?method=(.*)$ /$1.php?$2 [R=301,L]

When I navigate to the new url (http://www.mysite.com/index.php?A_File_Name) I am automatically redirected to my home page of my site.

My home page exists as;

[mysite.com...]
[mysite.com...]

What do I have to do to keep from being redirected to my home page?

My follow symlink is enabled, mod re-write is enabled, and all other things are in place.

The reason I want to keep the index.php? instead of turning the page into a .html is because I have good pagerank for any of my pages that start with the index.php?method=File_Name

Does anyone see a workaround for this?

jdMorgan

11:51 pm on Mar 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



classa,

I'm afraid this is backwards. Change your script to produce URLs like "http://www.mysite.com/index.php?A_File_Name"

and then use mod_rewrite to change those requests back to "/index.php?method=A_File_Name" when they are received from clients and search spiders. In this way, clients and search spiders see the shorter URL, and mod_rewrite changes it back to the form needed to call your script.

Mod_rewrite works after a request is received, and before any content is served or any scripts are activated. That is, it changes input URLs, not output URLs.

Jim