NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Hide query strings? [.htaccess or what?]

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-04-2007, 10:34 AM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



Hide query strings? [.htaccess or what?]


OK... my dad uses FrontPage to create html pages

So previously to make a page there would be a php page called whatever.php and a html body called whateverbody.html and the php would simple 'include' the body as well as head.php and foot.php. This system worked but took time, so now I made dynamic urls

so www.domain.com/page.php?content=whatever

^that would load whateverbody.php with the head and body

????: NamePros.com http://www.namepros.com/programming/301090-hide-query-strings-htaccess-or-what.html
The problem is this is not very memorable and the php files have got a lot of backlinks so it there a way of masking/redirecting any php page that is typed like pageone.php (not actually a physical file) and get it to redirect / mask to

www.domain.com/page.php?content=pageone

there will need to be some exeptions and there are some static urls that exist and with this rule they would not be able to be reached ( i think)

Thanks guys,

Mutasim

EDIT: a mate of mine suggests something called mod_rewrite :S
__________________
Lorem Ipsum
Last edited by Mutasim; 03-04-2007 at 10:44 AM.
H-O-V is offline  
Old 03-04-2007, 10:45 AM   #2 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




What you need to do is make a file called .htaccess, then use this code:
Code:
RewriteEngine on 
RewriteBase /
RewriteRule ^([.*]+).php$ whatever.php?content=$1 [L]
That should work
Barrucadu is offline  
Old 03-04-2007, 01:26 PM THREAD STARTER               #3 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



ok.... erm.. that doesn't seem to work :S

http://www.antibodypatterns.com/page...nt=amphiphysin

http://www.antibodypatterns.com/amphiphysin.php <-- doesn't work...

help

(btw: i did change whatever to page.php)
__________________
Lorem Ipsum
H-O-V is offline  
Old 03-04-2007, 01:32 PM   #4 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




Your server seems to be down, can you get on it?
Barrucadu is offline  
Old 03-04-2007, 02:17 PM THREAD STARTER               #5 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



hey please try now...
__________________
Lorem Ipsum
H-O-V is offline  
Old 03-04-2007, 02:20 PM   #6 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




try this:
Code:
RewriteEngine on 
RewriteBase /
RewriteRule ^([*]+).php$ whatever.php?content=$1 [L]
Btw, please dont PM me every time you reply, just because I posted in here dosn't mean I HAVE to keep helping you until its all working.
Barrucadu is offline  
Old 03-04-2007, 02:21 PM THREAD STARTER               #7 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



Originally Posted by Mikor
Btw, please dont PM me every time you reply, just because I posted in here dosn't mean I HAVE to keep helping you until its all working.
sorry its just the urgency was getting to me (I will add rep when I'm sorted )

still doesn't work

just to clear things up...

i need

http://www.antibodypatterns.com/amphiphysin.php to mask for http://www.antibodypatterns.com/page...nt=amphiphysin using htaccess
__________________
Lorem Ipsum
H-O-V is offline  
Old 03-04-2007, 02:49 PM   #8 (permalink)
NamePros Member
Join Date: Jan 2005
Posts: 112
lfhost is on a distinguished road
 



Before you try the below, you did change whatever.php in the code to page.php right?

or try

PHP Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule 
^(.*).phppage.php?content=$[L
__________________
Thanks
Paul
1|2|3|4|5|6|7|8|9|10|11|12|13
lfhost is offline  
Old 03-04-2007, 02:50 PM THREAD STARTER               #9 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



lfhost your code is bring content as 'page'

but its closest so far

so it is including pagebody.php
__________________
Lorem Ipsum
H-O-V is offline  
Old 03-04-2007, 02:59 PM   #10 (permalink)
NamePros Member
Join Date: Jan 2005
Posts: 112
lfhost is on a distinguished road
 



before you even try mod rewrite, try and fix your coding

http://www.antibodypatterns.com/page...nt=amphiphysin
shows
PHP Code:
Warningmain(pagebody.html) [function.main]: failed to open streamNo such file or directory in /home/abid/public_html/page.php on line 22
????: NamePros.com http://www.namepros.com/showthread.php?t=301090
????: NamePros.com http://www.namepros.com/showthread.php?t=301090

Warning
main(pagebody.html) [function.main]: failed to open streamNo such file or directory in /home/abid/public_html/page.php on line 22

Warning
main() [function.include]: Failed opening 'pagebody.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php'in /home/abid/public_html/page.php on line 22 
__________________
Thanks
Paul
1|2|3|4|5|6|7|8|9|10|11|12|13
lfhost is offline  
Old 03-05-2007, 12:06 AM THREAD STARTER               #11 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



that is something yo do with your htaccess...

when i remove it it all goes back to square 1
__________________
Lorem Ipsum
H-O-V is offline  
Old 03-05-2007, 02:14 AM   #12 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
You should stop the errors from displaying. Also in your code have you stopped someone choosing what page they visit? ie do you sanitize the $content variable? If you do not using that method to choose the html output could cause 'other' output of my choosing to be displayed with a little trial and error, this includes things like config files, password files etc.
Peter is offline  
Old 03-05-2007, 07:42 AM   #13 (permalink)
NamePros Regular
Join Date: Feb 2006
Posts: 584
jerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to all
 



Warning : This is highly insecure code.

Please at least check to make sure the file requested is in the same directory!
jerometan is offline  
Old 03-06-2007, 04:17 AM THREAD STARTER               #14 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



the include is it the same directory
__________________
Lorem Ipsum
H-O-V is offline  
Old 03-07-2007, 05:07 AM THREAD STARTER               #15 (permalink)
NamePros Regular
Join Date: Jun 2005
Location: UK
Posts: 518
H-O-V has a spectacular aura aboutH-O-V has a spectacular aura aboutH-O-V has a spectacular aura about
 



thanks anyway guys....

i got the answer off DigitalPoint
__________________
Lorem Ipsum
H-O-V is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:50 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger