Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

htaccess help >< please

Status
Not open for further replies.
Joined
Feb 10, 2006
Posts
321
Reaction score
24
Hi,

I know its late and im a bit tired, but this shouldn't be problem. I've got mind freeze.

I cant seem to get my .htaccess file right

Im trying to write

/fish[type].php

eg

/fishcarp.php

Code:
RewriteEngine On
RewriteRule ^fish([^/]*)\.html$ /fish-page.php?type=$1

this works

/fishcarp.html

but but not this

Code:
RewriteEngine On
RewriteRule ^fish([^/]*)\.php$ /fish-page.php?type=$1

for /fishcarp.php

I was thinking if it was a server i'm missing. Any ideas??
 
You may be better using something like


RewriteRule ^fish([a-z]+).php$ fish.php?fish=$1 [NC,L,QSA]
 
hi,

thats great.

do you know how I would make it work for more than one page?


I tried

Code:
RewriteRule ^fish([a-z]+).php$ fish.php?fish=$1 [NC, QSA] 
RewriteRule ^food([a-z]+).php$ food.php?fish=$1 [NC,QSA]
RewriteRule ^lifespan([a-z]+).php$ lifespan.php?fish=$1 [NC,L,QSA]

but its not working.

Any Ideas?
 
You need to intercept the variable in the above rewrites its going to $_GET["fish"] in php, so you need to make sure each script is accepting that.

Also you need 3 files fish.php/food.php/lifespan.php which are accepting the fish variable, there is no other reason it wouldn't work.
 
Yeah I've done this many times before and never had this problem though. Thanks for your help Skinner. I'm thinking something is different on the server I'm using. Going to test on another server later.

Thanks again.
 
I just added

RewriteRule ^fish([a-z]+).php$ fish.php?fish=$1 [NC,L,QSA]
RewriteRule ^pie([a-z]+).php$ pie.php?fish=$1 [NC,L,QSA]
RewriteRule ^recipe([a-z]+).php$ recipe.php?fish=$1 [NC,L,QSA]

and having just

<?php echo $_GET['fish']; ?>

in the 3 files, it works fine.

must be something server related.
 
Thanks skinner, that now works.

Think i'm cracking up.

I cant see the original problem, but just gald its sorted.

Thank you ver very much : )
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom