Jump to content


mod_rewrite help


6 replies to this topic

#1 FFX

    Young Padawan

  • Members
  • Pip
  • 105 posts

Posted 28 February 2006 - 07:34 PM

I am currently trying to turn


clicks.php?type=aff&aid=1

into

out/1/ (1 being the id of the affiliate)


In htaccess i put this code

RewriteRule ^out/[#aff_id]/?$ clicks.php?type=aff&aid=[#aff_id] [QSA,L]

and in the php link.
out/[aff_id]/

when i click the link it goes to /out/1/ (etc)

but the site it is supposed to go to doesn't work :(


Can anybody please help me ?

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 28 February 2006 - 09:28 PM

You need to use regex in the .htaccess, theres a great tutorial in "the answers to all your questions" sticky in this section on how to use it.

But, in short, you need to use:
RewriteRule ^out/[0-9]+/?$ clicks.php?type=aff&aid=$1


#3 Wybe

    Jedi In Training

  • Members
  • PipPip
  • 399 posts
  • Gender:Male
  • Location:the Netherlands
  • Interests:Graphic design, digital and traditional, street style, graffiti, guerilla drawing, typography, coding, sex

Posted 06 March 2006 - 11:43 AM

View PostGR3Z, on Mar 1 2006, 01:34 AM, said:

when i click the link it goes to /out/1/ (etc)

but the site it is supposed to go to doesn't work ^_^

Sounds like the mod_rewrite works fine only you forgot to make a proper clicks.php, which is ultimately responsible for redirecting the user to an affiliate (I think that's it, isnt it?)

#4 FFX

    Young Padawan

  • Members
  • Pip
  • 105 posts

Posted 07 March 2006 - 02:50 PM

its working fine now thanks

#5 FFX

    Young Padawan

  • Members
  • Pip
  • 105 posts

Posted 10 March 2006 - 08:59 AM

sorry for double post but i have now got another problem.
I looked on that site with mod_rewrite but couldnt find what i wanted.

i have this
RewriteRule ^[a-zA-Z0-9]/?$ index.php?id=author&author=[#t-wname]

so the [a-zA-Z0-9] mean that it can be any letters and any numbers, but when i try something like /Tutorial Pulse/ with a space i get page cannot be found so im guessing that i need to put something in the [a-zA-Z0-9] for a space, ive looked everywhere but I can't find it.

Can anybody help ?so the [a-zA-Z0-9] mean that it can be any letters and any numbers, but when i try something like /Tutorial Pulse/ with a space i get page cannot be found so im guessing that i need to put something in the

#6 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 10 March 2006 - 09:08 AM

I dont think you can use spaces, i suggest you use dashes instead

#7 FFX

    Young Padawan

  • Members
  • Pip
  • 105 posts

Posted 10 March 2006 - 12:27 PM

Ok i tried using a _ so it was like Tutorial_Pulse and that worked.

thanks anyway





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users