SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict bbparis's Avatar
    Join Date
    Aug 2008
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess question

    Hello,

    I tried to resolve my problem with the support of google search, but I had no chance. I just need to transfer
    everything inside ( htttp//:subdomain.mydomain.com/en ) to ( htttp//:www.mydomain.org/data/en ), how can I do that ?

    Thanks in advance for your help.

  2. #2
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    As you would likely want to save your Search Engine indexing then consider the following:


    • If you have access to the main apache.conf file then you can define an Apache RewriteMap that will permanently redirect all you links in http//:subdomain.mydomain.com/en to "http://www.mydomain.org/data/en"]www.mydomain.org/data/en. This cannot be done using .htaccess
    • If you only have access to .htaccess, then you will need to use 301 (Permanent Redirects) using mod_rewrite
    • You should keep both domains until you have all of you rewriting completed. You want to make sure that the search engine crawlers find a real site (not a 404 error), so don't cancel your old site until the redirects are complete and tested.
    • You also will need to create a new apache virtual host with all of your http//:subdomain.mydomain.com/en settings. If desired you can keep the same location for your new versus old site, you just have to ensure that you set the correct path to the files.
    • Finally you will need to set new DNS, A records your public DNS that will point to your new site.


    Regards,
    Steve
    ictus==""

  3. #3
    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)
    @ServerStorm ; I'm not sure why you would suggest a RewriteMap over a RewriteRule? The latter is a lot easier, since it's just a few lines of code that can be placed in a .htaccess

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.com$ [NC]
    RewriteRule ^en(/.*)?$ http://www.mydomain.com/data/en$1 [L,R=301]
    With a RewriteMap you'd have to list all individual redirects, which is a lot more work.

    I agree with all your other points though!
    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

  4. #4
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    Hi ScallioXTX,

    I recommend the rewrite map as it is easier to manage if the rerouting is complicated or there are an extensive amount of links; if the full site that the OP is moving is large or complicated then it may be the best option. If the OP does not have a lot of links to reroute or does not have access to their apache.conf files then as I also suggested (just not as clearly as you in my 2nd point ) the second option is to do as you outline; use a
    RewriteRule.

    Regards,
    Steve


    ictus==""

  5. #5
    SitePoint Addict bbparis's Avatar
    Join Date
    Aug 2008
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello and thanks for you both!!
    In fact I have tried the following code

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.com$ [NC]
    RewriteRule ^en(/.*)?$ http://www.mydomain.com/data/en$1 [L,R=301]
    in the .htaccess file in httpdocs folder in the subdomain hosting, nothing happened, why ?

    I tried also a sample code :

    But also I got error links...


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
  •