2

I have a really convoluted website that I need to work on. I was thinking on creating a single "home" php file that includes the main stuff (menu, sidenav, head, etc) and inserting the content for every page. I already have the content from all the pages separated so I have a duplicate of the site where all the html files have only the inner content ( i mean no , no menues, nothing except for the content). I would like to know if there is a way to redirect from any link that looks like www.site.com/example.html to www.site.com/script.php?url=example . That way, I can use the variable to insert the content files, or is there any other way to do such a thing?

2 Answers 2

2

Don't do that. That is bad practice in terms of security. Bad guys can specify urls such as:

www.site.com/script.php?url=../../../etc www.site.com/script.php?url=www.hackers.com www.site.com/script.php?url=www.xxx.com 

You must have a look at:

Sign up to request clarification or add additional context in comments.

2 Comments

mod_rewrite is a pretty common practice these days, no? As long as he doesn't mean a literal url as the PHP $_GET variables, he can validate the parameter against a list of verified strings. Pretty standard stuff in most frameworks.
I just want to do that so i dont have to change every link on 500+ html files... so Im looking for a way to server redirect every link that goes to "site.com/something/hello.html" and bring up "site.com/script.php?url=something/hello(.html)" I can do some url rewriting after to hide the script.php... but my main concern if it can be done
0

Already find a solution...

(.*) http://www.example.com/script.php?$1

where $1 is the variable c

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.