Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

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??
 
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.

Rule #1: Be Respectful

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.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom