Hide Subdirectory name in URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ryno du preez
    New Member
    • Jul 2011
    • 91

    Hide Subdirectory name in URL

    I 'm trying to hide my sub directory with in the URl
    exp wwww.exsample.c om/directory/index.php I want to display it as www.exsample.co m/index.php
    Below is the Htaccess script I'm using but it causes my site to break
    Code:
    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule (.*) $1\.php [L]
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+dirname/([^\s]+) [NC]
    RewriteRule ^ %1 [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (?!^dirname/)^(.*)$ /dirname/$1 [L,NC]
    While my site is loaded in to Chase the script works very well but when I reload the page the site does not load correctly.



    Any advice will be creat
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    THE_REQUEST is not a valid rewrite condition target.

    Comment

    • ryno du preez
      New Member
      • Jul 2011
      • 91

      #3
      Thank you for your reply What must I use

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        What must I use
        RewriteRule, not RewriteCond.

        Comment

        • ryno du preez
          New Member
          • Jul 2011
          • 91

          #5
          thank you I'll Try that

          Comment

          Working...