Assistance with a .htaccess file

Discussion in 'Programming' started by ollyno1uk, Sep 28, 2007.

  1. #1
    ollyno1uk, Sep 28, 2007 IP
  2. protocol96

    protocol96 Peon

    Messages:
    413
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^jbosolutions.ollysguitar.com/blog [NC]
    RewriteRule ^(.*)$ http://www.jbosolutions.co.uk/blog/$1 [L,R=301]
    PHP:
    wrong section though!!
     
    protocol96, Sep 28, 2007 IP
  3. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #3
    @protocol, the path is not part of the host.

    Also, you do not need to check the host in this case as two URLs don't share the same web root.

    RewriteEngine On
    RewriteRule ^/blog(.*)$ http://www.jbosolutions.co.uk/blog$1 [R=301,L]
    Code (markup):
     
    krt, Sep 28, 2007 IP
  4. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #4
    Ok I have tried both of these combinations in both the .htaccess of jbosolutions.co.uk and ollysguitar.com and neiter seem to work


    protocol96 - this coverts http://www.jbosolutions.co.uk/blog to http://jbosolutions.ollysguitar.com which is teh opposite of what I was hoping for.


    krt this did not seem to make a difference in either of the files.

    Hoping for an answer
     
    ollyno1uk, Sep 28, 2007 IP
  5. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #5
    With reference above - Is there any rule where these need to go in the .htaccess file as I have just been inserting it anywhere?

    Thanks a lot
     
    ollyno1uk, Sep 28, 2007 IP
  6. protocol96

    protocol96 Peon

    Messages:
    413
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^jbosolutions.co.uk/blog/ [NC]
    RewriteRule ^(.*)$ http://www.jbosolutions.ollysguitar.com/blog/$1 [L,R=301] 
    PHP:

    try this and lemme know!
     
    protocol96, Sep 28, 2007 IP
  7. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #7
    ollyno1uk, Sep 29, 2007 IP
  8. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #8
    ollyno1uk, Sep 29, 2007 IP
  9. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #9
    Remember to put this in the htaccess for jbosolutions.ollysguitar.com only, not both sites:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^blog(.*)$ http://www.jbosolutions.co.uk/blog$1 [R=301,L]
    Code (markup):
    Also, when it doesn't work, please be a bit more specific. Does it give a blank page, a 404 error, a 500 error, does it stay at the old host URL etc.
     
    krt, Sep 29, 2007 IP
  10. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #10
    Hi Thanks

    Here is my .htaccess in jbosolutions.co.uk

    
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^jbosolutions.co.uk [nc]
    rewriterule ^(.*)$ http://www.jbosolutions.co.uk/$1 [r=301,nc]
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^blog(.*)$ http://www.jbosolutions.co.uk/blog$1 [R=301,L]
    
    # Eliminates duplicate home page i.e.: www.domain.com/index.php and www.domain.com appear as duplicate home page
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.jbosolutions.co.uk/ [R=301,L]
    Code (markup):
    This seems to have no effect - this is currently how I will leave the .htacess file so you can see what it does.

    I have a jbosolutions.co.uk directory. In here I have changed the .htaccess
     
    ollyno1uk, Sep 29, 2007 IP
  11. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #11
    Why are you putting it in the web root for jbo...co.uk? I said only for jbo...ollyguitar.com
     
    krt, Sep 29, 2007 IP
  12. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #12
    I don't have a web root for jbosolutions.ollsguitar.com - With my host I have ollysgutar.com as a primary domain then all the others are within folders under that domain like jbosulitons.co.uk. there is no other folders.
     
    ollyno1uk, Sep 29, 2007 IP
  13. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #13
    Is there anyone else that can offer any advice on this problem?
     
    ollyno1uk, Sep 30, 2007 IP
  14. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #14
    How can it not have a web root? At very least, it shares one in the case of a server alias.
     
    krt, Oct 1, 2007 IP
  15. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #15
    I asked my host and they said its the way Cpanel choose to do it. I have only a webroot for ollysguitar.com then within this folder is the webroot for jbosolutions.co.uk along with my other websites.
     
    ollyno1uk, Oct 1, 2007 IP