Page 1 of 1

htaccess problem

Posted: Mon Oct 20, 2008 1:03 pm
by dude81
Hi,

I've a website always coming in the fashion of

Code: Select all

index.php?x=mod&y=file
(dotproject style) in which this retrieves file.php from module called "mod". Now I want to make this url SEO friendly i.e website in the form of

Code: Select all

/mod/file/other/parameters/in/this/fashion
. I know this could be achieved through rewrite rules. If somebody can give us knowledge or idea of how to do it, that would be great. I tried searching, I could not get much help.

Thank You

Re: htaccess problem

Posted: Mon Oct 20, 2008 2:26 pm
by requinix
Sorry if I didn't notice, but was this a PHP question :|

Turning each of those other/parameters/in/this/fashion into var1=other&var2=parameters&etc using mod_rewrite is a pain. It'd be much nicer if the code would turn the /-list into variables itself.

Code: Select all

RewriteRule ^/?([^/]+)/([^/]+)/(.*) index.php?x=$1&y=$2&vars=$3
Add flags as desired. If you add [QSA] you could have URLs like

Code: Select all

/mod/file/?var1=other&var2=parameters&etc
One thing you'll have to address: links. The various modules and stuff might link back to themselves (eg, a <form> target) - they should use the SEO addresses instead.

Re: htaccess problem

Posted: Mon Oct 20, 2008 3:30 pm
by dude81
well, its a PHP question. Check the following string "index.php?x=mod&y=file" :wink:
Thank you for the solution.

Re: htaccess problem

Posted: Mon Oct 20, 2008 4:09 pm
by requinix
dude81 wrote:well, its a PHP question. Check the following string "index.php?x=mod&y=file" :wink:
Thank you for the solution.
Just to argue the point, it could have been

Code: Select all

index.aspx?x=mod&y=file
and it wouldn't have made any difference.

Re: htaccess problem

Posted: Mon Oct 20, 2008 4:41 pm
by dude81
tasairis wrote: Just to argue the point, it could have been

Code: Select all

index.aspx?x=mod&y=file
and it wouldn't have made any difference.
..
May be if somebody could show, how to compile .net with Apache.. it sure would have done :wink:, also point to be noted is that php.ini would allow asp tags to be configured for php...., which is php again, so I'm still right :)

Re: htaccess problem

Posted: Mon Oct 20, 2008 6:08 pm
by requinix
dude81 wrote:
tasairis wrote: Just to argue the point, it could have been

Code: Select all

index.aspx?x=mod&y=file
and it wouldn't have made any difference.
..
May be if somebody could show, how to compile .net with Apache.. it sure would have done :wink:, also point to be noted is that php.ini would allow asp tags to be configured for php...., which is php again, so I'm still right :)
mod_aspdotnet, or if you don't like that,

Code: Select all

index.pl?x=mod&y=file
I'm still right :D

Re: htaccess problem

Posted: Mon Oct 20, 2008 6:59 pm
by dude81
:bow: :bow: You win.. :bow: :bow:.. but you should know one fact, php can parse any type of file just by changing the following line in apache

Code: Select all

AddType application/x-httpd-php .php .html .pl
, Am I still right?

Re: htaccess problem

Posted: Mon Oct 20, 2008 7:20 pm
by requinix
True, but you could do the same thing in the other direction: make ASP.NET/Perl handle a .php file ;)

Re: htaccess problem

Posted: Tue Oct 21, 2008 10:16 am
by pickle
This is not a PHP issue, this is an Apache issue. Moving thread.