Forum Moderators: coopster

Message Too Old, No Replies

mod_rewrite style urls on IIS

         

HoagieKat

5:37 pm on Mar 13, 2006 (gmt 0)

10+ Year Member



Hi all,

I'm interested in using PHP to do a simple mod_rewrite function on IIS, my site is on a shared server, so I don't have access to the administrator side of things, so I was wondering if I could use a php script as an intermediary, instead of using '?' as the delimiter for a query string, you pass a string like:

www.sitename.com/obj.php/section/id/10/

obj.php would work out what exactly you're trying to do, and to a search engine I'm assuming that it'll look like a directory as opposed to a script?

I'm sure it's easy to do, it's just the search engine implications of doing it I'm interested in.

Any thoughts?

webdoctor

1:07 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



in using PHP to do a simple mod_rewrite function on IIS

1. PHP has nothing to do with mod_rewrite

2. mod_rewrite is an Apache module, it is not part of IIS. You need ISAPI_Rewrite. It has nothing do with PHP.

HoagieKat

1:27 pm on Mar 14, 2006 (gmt 0)

10+ Year Member



You misunderstand, I know mod_rewrite is apache, and I know about IIS_Rewrite, but on a server that hasn't got access to either is it possible to emulate that functionality using a PHP intermediate page.

webdoctor

1:33 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you use URIs like this

www.example.com/script.php/var1/apple/var2/banana

then you need either mod_rewrite or ISAPI_rewrite to get script.php to receive the request.

PHP on its own isn't enough - the webserver will interpret the URL as a request for the file 'banana' in the folder '/script.php/var1/apple/var2/'

coopster

2:02 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could use Apache Content Negotiation [httpd.apache.org] which is much cleaner and faster than mod_rewrite, IMHO. You can do a real simple server test by adding MultiViews to your Options in an .htaccess file (if your hosting provider allows this). Then, a request for the page you specified would fire off your script, obj.php. In obj.php you would have to parse the rest of the REQUEST_URI to grab the variables which look like a folder structure. Search engines have absolutely no problem with this method.

webdoctor

2:05 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could use Apache Content Negotiation <snip>

The original poster is running IIS :-)

coopster

6:51 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Ah yes, thanks webdoctor. Boy, the title, the first four posts ... IIS, IIS, IIS ... and I still offer an Apache solution. Some days you wonder where your mind went ;)