SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess - changing folder name

    How can I change the name of a folder. EG: when I type into the address bar - www.mydomain.com/verylongfoldername, it actually goes to www.mydomain.com/shortfoldername ? I dont want to physically change the folder name (due to reasons I wont go into here). I guess .htaccess would be the best way to do this. I suppose Im after a way to cloak the url.

  2. #2
    SitePoint Evangelist simshaun's Avatar
    Join Date
    Apr 2008
    Location
    North Carolina
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look into htaccess url rewrite -ing.

    Check out this page.

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you try creating a simbolic link in your server?

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I looked at that link, and it shows how to rewrite php page to htm etc... and I tried to hash the script so it woudl rewrite "/something" to "/somethingelse" and couldnt for the life of me get it working! I cant imagine it being that hard to do - but I cant do it. I though that the server might be caching my .htaccess file or something.
    Can you see why the below wont work (rewriting a folder 'something' to 'somethingelse')?

    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^something$ $1somethingelse [NC]

  5. #5
    SitePoint Enthusiast pudding's Avatar
    Join Date
    May 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bear in mind that $1 is only if you're taking a variable from the left and putting it on the right
    In example
    ^([/0-9/])$ index?id=$1
    would take the number and throw it over to the ID.

    Code may be off cause it's 2:00 AM but you get the idea, I hope.

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ive just tried

    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^something somethingelse [NC]

    Still doesnt work. I'm stumped! I can't find an example which does this on the net.

  7. #7
    SitePoint Evangelist simshaun's Avatar
    Join Date
    Apr 2008
    Location
    North Carolina
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try adding a slash or two...

  8. #8
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where to?


Bookmarks

Posting Permissions

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