Jump to content


No .php


9 replies to this topic

#1 dEcade

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 1,850 posts
  • Gender:Male
  • Location:Saskatoon, Saskatchewan
  • Interests:Guitar, Programming, Storm Chasing, Games (Designing and playing), Hockey, Photography

Posted 20 August 2006 - 11:11 AM

Hi, Okay basicly I was wondering if there is a script out there to make it so that my file does not have .php at the end it would just be the word. It is for my search, so instead of being search.php?searchbox= it would just be search?searchbox=

thanks,

dEcade

#2 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 20 August 2006 - 11:19 AM

You can use mod_rewrite for that :P

RewriteEngine on
RewriteRule ^search?searchbox=(.*)$ search.php?searchbox=$1

Should work, but im not a big mod_rewrite guy. Im sure someone will tweak it lol.

#3 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 20 August 2006 - 11:20 AM

depending on what exactly you want to do, you would either need to use mod_rewrite to rewrite the url to a PHP file or add whatever extension you want to the application handlers.

Quote

.decade application/x-httpd-php
would mean

search.decade?searchbox=

I don't believe you can have an empty extension though, mod_rewrite would be good for that.

Options +FollowSymLinks
RewriteEngine on
RewriteRule search?(.*)$ /search.php?searchbox=$1
http://www.yourdomain.com/search?searchquery

would be the same as

http://www.yourdomain.com/search.php?searchbox=searchquery

Edited by SpatialVisionary, 20 August 2006 - 11:28 AM.


#4 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 20 August 2006 - 11:22 AM

OH HO HO owned SpatialVisionary, finally got one in before someone again lol!

*mini yay*

Edited by .Matt, 20 August 2006 - 11:22 AM.


#5 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 20 August 2006 - 11:27 AM

View Post.Matt, on Aug 20 2006, 04:21 PM, said:

OH HO HO owned SpatialVisionary, finally got one in before someone again lol!

*mini yay*

Posted Image


:P

#6 Tirus

    P2L Jedi

  • Members
  • PipPipPip
  • 764 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design, Programming, Music, Martial Arts

Posted 20 August 2006 - 11:36 AM

View PostSpatialVisionary, on Aug 20 2006, 12:26 PM, said:

Posted Image
look at him go! :o

Edited by Tirus, 20 August 2006 - 07:25 PM.


#7 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 24 August 2006 - 08:05 AM

I'm sorry to bump their topic, I'm having trouble wiht mod_rewrite and i'm going to be using it a lot for a lot of different things...which makes it an even bigger problem. I bumped it cause I didn't think anyone would want to see another topic like this made.
http://mysite.com/in...hp?news=1&id=12
how could I turn that into
http://mysite.com/news/article/12
12 is the dynamic part of the page fyi.
But from what i've seen, I would have to do more than that to make mod_rewrite work. like:
http://mysite.com/ne...le/something/12
Sorry to be so dense here, I'm just racking my brain trying to figure this out. Thank you very much everyone.

#8 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 24 August 2006 - 01:09 PM

check that out in the 'Free Resources' forum.

-_-

#9 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 25 August 2006 - 02:14 AM

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'news/article/12,5' at line 1
What do I need to look for here :P
MySQL version: 4.1.21

#10 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 25 August 2006 - 03:36 PM

RewriteRule ^news/article/(.*)/([0-9]+)$ /index.php?news=1&id=$1&something=$2 [nc]
RewriteRule ^news/article/([0-9]+)$ /index.php?news=1&id=$1 [nc]

I'm not quite sure what you need where I put 'something' becuase you haven't stated the other variable you need to put into your URL.
One thing I have learned about rewriterules is you need to always have the longer ones listed first, for example for a site I've built, this is a small snippet for the tutorials section.
RewriteRule ^tutorial/([0-9]+)$ /index.php?id=view_tutorial&tut=$1 [nc,L]
RewriteRule ^tutorials/search$ /index.php?id=search&search=tutorials [nc,L]
RewriteRule ^tutorials/([a-z]+)/([0-9]+)$ /index.php?id=tutorials&cat=$1&page=$2 [nc,L]
RewriteRule ^tutorials/([a-z]+)$ /index.php?id=tutorials&cat=$1 [nc,L]
RewriteRule ^tutorials/authors/(.+)$ /index.php?id=tutorials&author=$1 [nc,L]
(The admin section rewrites are easier to see what I'm talking about, but I'd rather not share those. :P)
(Don't ask me what the L means, but the nc means that it isn't case-sensitive.)

That is so that if it sees the first match has all those slashes and stuff, then it does that first, other wise is would pass a ton of variables to the wrong page (and you'd get an ugly error, as it would pass the wrong things, such as passing the '/' with just an $id or something).

Edited by Demonslay, 25 August 2006 - 03:41 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users