i want when any user type a mar.com/work.php it aces the page but url is showing mar.com/

Recommended Answers

All 5 Replies

Why don't you save work.php as index.php ?

Member Avatar for diafol

have you got a redirect or a .htaccess file set up? Are you using a php framework?

work.php is file in webdirectory no i do not want any redirect i want to hide my complete url

Member Avatar for diafol

OK, now I get it. Apache rewrite rules in .htaccess is probably what you're looking for. Thing is, if you just type in the base url (www.example.com), how will your site know which page to serve if you set all your pages to that?

People usually route all their page requests though the index.php file and 'prettify' their urls to virtual folders, e.g.

www.example.com/index.php?page=work will become www.example.com/work/

However trying to do this:

www.example.com/work.php => www.example.com
www.example.com/about.php => www.example.com
www.example.com/another.php => www.example.com

Will cause confusion. Imagine you bookmarked www.example.com - where should it go? SEO would be another issue. Something to avoid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.