Dynadot โ€” .com Registration $8.99

Hide query strings? [.htaccess or what?]

Spaceship Spaceship
Watch

H-O-V

Established Member
Impact
2
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

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 (:p i think)

Thanks guys,

Mutasim

EDIT: a mate of mine suggests something called mod_rewrite :S
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
 
1
•••
0
•••
Your server seems to be down, can you get on it?
 
0
•••
hey please try now...
 
0
•••
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.
 
0
•••
0
•••
Before you try the below, you did change whatever.php in the code to page.php right?

or try

PHP:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*).php$ page.php?content=$1 [L]
 
0
•••
lfhost your code is bring content as 'page'

but its closest so far :P

so it is including pagebody.php
 
0
•••
before you even try mod rewrite, try and fix your coding

http://www.antibodypatterns.com/page.php?content=amphiphysin
shows
PHP:
Warning: main(pagebody.html) [function.main]: failed to open stream: No such file or directory in /home/abid/public_html/page.php on line 22

Warning: main(pagebody.html) [function.main]: failed to open stream: No 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
 
0
•••
that is something yo do with your htaccess...

when i remove it it all goes back to square 1
 
0
•••
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.
 
0
•••
Warning : This is highly insecure code.

Please at least check to make sure the file requested is in the same directory!
 
0
•••
the include is it the same directory
 
0
•••
thanks anyway guys....

i got the answer off DigitalPoint
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back