Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite / RewriteRule

Just a small tweak...

         

urbanroute

12:11 am on Jan 17, 2007 (gmt 0)

10+ Year Member



I need help solving something that is probably very easy for most of you but it's taking me in circles. Please help.

The main issue is with the .htaccess file.

I use RewriteRule ^(.*)$ gallery.php?q=$1 [L,QSA] to rewrite the query string correctly but it only works some of the times.

IE:
http://example.com/gallery/dothis/gallery/section/article/cmd/list/category/1

(works fine) but...

http://example.com/gallery.php/dothis/gallery/section/article/cmd/list/category/1

(results in a No input file specified).

The only different is the .php in the URL. I'm pretty sure it's because of the syntax in the RewriteRule but I don't know much about them.

Bascially the site needs to rewrite all the query strings:
http://example.com/gallery.php/dothis/gallery/section/article/cmd/list/category/1

should become:

http://example.com/gallery.php&dothis=gallery&section=article&cmd=list&category=1

It's already working when the URL points to gallery/ but not when gallery.php/ is part of the file.

Help is much appreciated!

[edited by: jatar_k at 12:14 am (utc) on Jan. 17, 2007]
[edit reason] examplified [/edit]

jdMorgan

2:08 am on Jan 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As far as Apache is concerned, the URL ends after ".php". I suggest that you use "." only once an the end of the URL to specify a filetype if needed, and for no other purpose.

Ref: RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org]

Jim