dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Redirecting links within a subfolder

Hybrid View

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    Redirecting links within a subfolder

    I'm brand new to this site, so please excuse if I've posted this in the wrong area.

    I'm developing a website for a customer located at www.mydomain.com/projects/customer. This site will eventually be moved to www.customer.com.

    I'm trying to style my links as straight /index.html and /about.html, INSTEAD OF /projects/customer/index.html and /projects/customer/about.html so when the site is moved, I won't have to redo a hundred links and change them all back to /index.html and /about.html.

    I tried creating a .htaccess file in the /projects/customer folder that said:

    Options +FollowSymlinks

    RewriteEngine on
    RewriteRule ^index/$ /projects/customer/index.html [L]
    RewriteRule ^about/$ /projects/customer/about.html [L]

    My thinking is that it should take a link called /about.html and show instead /projects/customer/about.html, but it's just plum not working. /about.html still goes to www.mydomain.com/about.html

    I'm very new to .htaccess and don't really know what I'm doing, and I have no idea if there's a better way to do this anyway. Can anyone help??

    Thank you!!

  2. #2
    Join Date
    Aug 2012
    Posts
    2
    Oh!! I was, apparently, making this wayyy too complicated. At the head of each page I simply put in:


    <base href="http://mydomain.com/projects/customer/" ></base>

    And suddenly, all my index.html and about.html links are now going to mydomain.com/projects/customer/index.html etc.

    I figure when I move the site to my customer's domain I'll just omit that line from the head of each page (MUCH easier than rewriting all the links!) and all will be well?

    Actually, I should probably change it to


    <base href="http://mydomain.com/projects/customer" ></base>

    with NO trailing slash, and change my index.html links to /index.html, right? Because without a base href all links will try to go to www.customer.comindex, right? Not www.customer.com/index?

    Sorry for the crazy newbie questions!! I'm new to moving sites around servers and just trying to make it easier on myself.

    Thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles