SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mod rewrite rule

    My files are in ...

    /public_html/blog-subsite/index.html

    on the server.

    But I want people to access the index.html file by ...
    Code:
    http://www.example.com/blog/index.htm
    What is the correct ReWriteRule in .htaccess that will do that?

    Not just for index.html, but for all files within that directory.

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,080
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    is there a reason you can't just rename the "blog-subsite" directory to "blog" ?
    That would be a lot more efficient.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you only change the name, you can loose any backlinks you might have to your blog, because they will not find you anymore. So you can rename your blog and besides configure a permanent redirection to your blog from your old url, something like this:

    RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.example\.com$
    RewriteRule ^blog\-subsite\/?(.*)$ "http\:\/\/www\.example\.com\/blog$1" [R=301,L]
    Web designer, programmer & webmaster for 7+ years
    Hosting 11 sites in Hospedaje Web México
    CentOS|cPanel|R1Soft|Softaculous|Cloud Hosting|Green Hosting

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    lal,

    Rémon is correct about moving the blog's directory after which you can use .htaccess to redirect from the old link to the new link with a R=301 for the SEs.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •