Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder DR.Wong's Avatar
    Join Date
    Jan 2005
    Posts
    360
    Thanks
    23
    Thanked 1 Time in 1 Post

    mod_rewrite : make a "fake" directory that displays an "index.php" from another folde

    Hey there,

    I'm attempting to use clean URLs.

    The about page my site is located at http://www.example.com/frontEnd/about.php

    I'd like to access it by merely typing in http://www.example.com/about/

    Similar to how you clean ugly variables in a URL :

    Code:
    RewriteEngine On
    RewriteRule ^([\w\-]+)/?$ index.php?var=$1
    I've been playing around with mod_rewrite in the .htaccess file in the root directory, but I can't seem to get it to work.

    I've tried :

    Code:
    RewriteEngine On
    RewriteRule ^/about/?$ frontEnd/about.php
    But this doesn't seem to work.
    Last edited by DR.Wong; 02-03-2013 at 01:54 PM.
    -DR.Wong

    Wheres the food at?

  • #2
    Regular Coder DR.Wong's Avatar
    Join Date
    Jan 2005
    Posts
    360
    Thanks
    23
    Thanked 1 Time in 1 Post

    Thumbs up Solved

    I've figured it out.

    The problem was that I included a "/" before the name of the "fake" directory.

    Here's the solution :

    Code:
    RewriteEngine On
    RewriteRule ^contact/?$ frontEnd/contact.php
    RewriteRule ^about/?$ frontEnd/about.php
    This is really useful if you want to keep your website directory structure well organized!
    -DR.Wong

    Wheres the food at?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •