No .php
Started by dEcade, Aug 20 2006 11:11 AM
9 replies to this topic
#1
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
thanks,
dEcade
#2
Posted 20 August 2006 - 11:19 AM
You can use mod_rewrite for that 
Should work, but im not a big mod_rewrite guy. Im sure someone will tweak it lol.
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
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.
would mean
search.decade?searchbox=
I don't believe you can have an empty extension though, mod_rewrite would be good for that.
would be the same as
http://www.yourdomain.com/search.php?searchbox=searchquery
Quote
.decade application/x-httpd-php
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=$1http://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
Posted 20 August 2006 - 11:22 AM
OH HO HO owned SpatialVisionary, finally got one in before someone again lol!
*mini yay*
*mini yay*
Edited by .Matt, 20 August 2006 - 11:22 AM.
#7
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.
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.
#9
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
MySQL version: 4.1.21
What do I need to look for here
MySQL version: 4.1.21
#10
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.
(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

