DISQUS

Hell Yeah Bitch! .com: Clean URLs Are All the Rage

  • danielcole · 4 years ago
    I switched mt.net over to clean urls a few months ago (away from .php's). I was having trouble getting my reg. expression correct in the .htaccess until I realized that it's easier to just pass the entire url argument string to index.php and parse it there.

    Now the whole site is database driven and adding a new 'page' is just adding a new entry into a mysql table. I can specify page title, icon, and if it's a public or password-protected page.

    There was a problem with having the .htaccess in the root folder and bleeding into other areas of the webserver (test sites, internal stuff, etc). Putting a one-line .htaccess with 'RewriteEngine off' turns it off for all url requests for that subfolder and below.

    Also realize that a lot of places link to specific pages on your site (random blogs, Google). If you drop the .php extension entirely your 404 Error page will explode. For a while you have to make sure to write your redirect expressions to account for both types of requests. I don't know how MT organizes files at all, so this may or may not be a problem. On my homegrown site it was a biggie.