0

I am new to this kind of functionality. I saw this in action in several frameworks such as codeigniter, wordpress and more. It's the ability to rewrite the URL.

suppose i have a file system like

  • htdocs
    • pages
      • home.php
      • about.php
      • services.php
      • products.php
      • contact.php
      • and so on...
    • core
      • class_database.php
      • class_filesystem.php
      • class_account_manager.php
      • and so on...
    • index.php
    • config.php
    • and so on... How do i do it so that i can rewrite the url request like this. for instance a user request the home page, instead of accessing the home page via the URL: example.com/pages/home.php, he'll just input example.com/home?

Is there any way to do this with only php code for the sake of mobility?

Thanks in advance for the help.

Chum H
  • 47
  • 7
  • URL Rewrites are dependent on the Web Server. In this case it's apache. If you move to IIS, you have to import the .htaccess rules into URL Rewriter. Since most Web Servers have URL Rewrite, this is not a big issue. – Twisty Apr 23 '15 at 00:21
  • I see, i am using linux servers. I'm interested about how codeigniter and wordpress do this tho. It's like no configuration needed, it's ready to use. I'm wondering how they do that. Works anywhere from apache to IIS. – Chum H Apr 23 '15 at 01:01

0 Answers0