htaccess problem

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

htaccess problem

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: htaccess problem

Post 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.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: htaccess problem

Post by dude81 »

well, its a PHP question. Check the following string "index.php?x=mod&y=file" :wink:
Thank you for the solution.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: htaccess problem

Post 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.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: htaccess problem

Post 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 :)
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: htaccess problem

Post 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
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: htaccess problem

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: htaccess problem

Post by requinix »

True, but you could do the same thing in the other direction: make ASP.NET/Perl handle a .php file ;)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: htaccess problem

Post by pickle »

This is not a PHP issue, this is an Apache issue. Moving thread.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply