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 4 of 4
  1. #1
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts

    .htaccess Rewrite help

    Hi, ok so I have designed a new site and its located in my main directory under a folder called "new_site" so my url to the new site is as follows:


    http://www.mysite.com/new_site/index.php

    I have used .htaccess files to rewrite urls that are passing variables with in the url to a more SEO friendly url. My questions is can I use a .htaccess file to strip out the /new_site/ from the url instead of having to migrate the new site out of this folder and spend days finding and changing all the links images and database content that carry /new_site/ in it.

    Any ideas?

    Thanks.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by ubh View Post
    Hi, ok so I have designed a new site and its located in my main directory under a folder called "new_site" so my url to the new site is as follows:


    http://www.mysite.com/new_site/index.php

    I have used .htaccess files to rewrite urls that are passing variables with in the url to a more SEO friendly url. My questions is can I use a .htaccess file to strip out the /new_site/ from the url instead of having to migrate the new site out of this folder and spend days finding and changing all the links images and database content that carry /new_site/ in it.

    Any ideas?

    Thanks.
    if you use apache 2 this will help you:

    http://httpd.apache.org/docs/2.2/rew...ite_guide.html

    using redirection in general is not a good idea and in your case is more simple to use some tools to automate the proccess of changing url in your code.
    Usualy you don't have this problem if you keep in mind that problem when you design your code. The simplest way is to use relative uri to the root document.

    best regards

  • #3
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    Hmm, ok so I can simply tell my root dir "/" to be redirected to /new_site/.

    But how do I remove all traces of /new_site/ from my url is the million dollar question.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by ubh View Post
    Hmm, ok so I can simply tell my root dir "/" to be redirected to /new_site/.

    But how do I remove all traces of /new_site/ from my url is the million dollar question.
    find some tools you can use, you feel confortable with, for search and replace in multiple files inside a tree directory.. This will also help you to change spaces to - or _.
    I don't use windows and usualy I don't use visual tools so I can't recommand something and probably command line tools don't help you. I'm sorry. For me, using my tools is a few minutes task and I guess same thing is true if you find a proper tool for you.

    best regards


  •  

    Posting Permissions

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