1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess redirect issue - robots.txt

Discussion in 'Apache' started by tommydamic68, Jan 12, 2014.

  1. #1
    Hello all,

    Hoping someone can help with this issue with my .htaccess redirect. so a bit of history, I had a Vbulletin (3.8) forum script that had the .htaaccess file you see below, I was using VBSEO (an SEO script that change the URL to be search engine friendly.) I then moved my forum over to Xenforo software, so the threads needed to be redirected as well as my URL - here is the additional code I was given which I just dropped in the top of the .htaccess file.

    Code (Text):
    1. Options -Indexes  
    2. RewriteEngine On
    3. RewriteCond %{HTTP_HOST} www.mysite.com$
    4. RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
    5. RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
    6. RewriteRule ^forum\.php$ /community/ [R=301,L]
    7. RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
    8. RewriteRule ^.*$ /community/ [R=301,L]

    The problem is this,
    when looking for www.mysite.com/robots.txt it redirects back to www.mysite.com

    Please help with this issue, its frustrating to say the least!

    Thanks in advance!

    Code (Text):
    1. Options -Indexes  
    2. RewriteEngine On
    3. RewriteCond %{HTTP_HOST} www.mysite.com$
    4. RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
    5. RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
    6. RewriteRule ^forum\.php$ /community/ [R=301,L]
    7. RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
    8. RewriteRule ^.*$ /community/ [R=301,L]
    9.  
    10. # Use PHP 5.3
    11. AddType application/x-httpd-php53 .php
    12.  
    13. # Ticket PBB-18872701
    14. <IfModule mod_suphp.c>
    15.   suPHP_ConfigPath /home/admin/public_html
    16.   <Files php.ini>
    17.     order allow,deny
    18.     deny from all
    19.   </Files>
    20. </IfModule>
    21. # Ticket PBB-18872701
    22.  
    23. DirectoryIndex index.php
    24. #RewriteEngine Off
    25.  
    26. # Comment the following line (add '#' at the beginning)
    27. # to disable mod_rewrite functions.
    28. # Please note: you still need to disable the hack in
    29. # the vBSEO control panel to stop url rewrites.
    30. RewriteEngine On
    31.  
    32. RewriteCond %{HTTP_HOST} ^mysite.com$
    33. RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/" [R=301,L]
    34.  
    35. RewriteCond %{HTTP_HOST} ^mysite.com$
    36. RewriteRule ^forum\.php\/?(.*)$ "http\:\/\/www\.mysite\.com\/forum\.php$1" [R=301,L]
    37.  
    38. # Some servers require the Rewritebase directive to be
    39. # enabled (remove '#' at the beginning to activate)
    40. # Please note: when enabled, you must include the path
    41. # to your root vB folder (i.e. RewriteBase /forums/)
    42. #RewriteBase /
    43.  
    44. #RewriteCond %{HTTP_HOST} !^www\.mysite\.com
    45. #RewriteRule (.*) http://www.mysite.com/$1 [L,R=301]
    46.  
    47. RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    48.  
    49. RewriteCond %{REQUEST_URI} !(admincpvioc1/|modcpvioc2/|cron|vbseo_sitemap)
    50. RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]
    51.  
    52. RewriteCond %{REQUEST_FILENAME} !-f
    53. RewriteCond %{REQUEST_FILENAME} !-d
    54. RewriteCond %{REQUEST_FILENAME} !/(admincpvioc1|modcpvioc2|clientscript|cpstyles|images)/
    55. RewriteRule ^(.+)$ vbseo.php [L,QSA]
    56.  
    57. <Files 403.shtml>
    58. order allow,deny
    59. allow from all
    60. </Files>
    61.  
    62. RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [NC]
    63.  
    64. #RewriteCond %{HTTP_HOST} ^mysite.com$
    65. #RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/" [R=301,L]
    66.  
    67. #RewriteCond %{HTTP_HOST} ^mysite.com$
    68. #RewriteRule ^forum\.+\/?(.*)$ "http\:\/\/www\.mysite\.com\/forum\.php$1" [R=301,L]
    69. # Expire images header
    70. ExpiresActive On
    71. ExpiresDefault A0
    72. ExpiresByType image/gif A2592000
    73. ExpiresByType image/png A2592000
    74. ExpiresByType image/jpg A2592000
    75. ExpiresByType image/jpeg A2592000
    76. ExpiresByType image/ico A2592000
    77. ExpiresByType text/css A2592000
    78. ExpiresByType text/javascript A2592000
    79. # compress text, html, javascript, css, xml:
    80. AddOutputFilterByType DEFLATE text/plain
    81. AddOutputFilterByType DEFLATE text/html
    82. AddOutputFilterByType DEFLATE text/xml
    83. AddOutputFilterByType DEFLATE text/css
    84. AddOutputFilterByType DEFLATE application/xml
    85. AddOutputFilterByType DEFLATE application/xhtml+xml
    86. AddOutputFilterByType DEFLATE application/rss+xml
    87. AddOutputFilterByType DEFLATE application/javascript
    88. AddOutputFilterByType DEFLATE application/x-javascript
    89. # Or, compress certain file types by extension:
    90. <files *.html>
    91. SetOutputFilter DEFLATE
    92. </files>
    93.  
    94. RewriteEngine On
    95. RewriteRule ^Microsoft-Server-ActiveSync$ hgpush/index.php
    tommydamic68, Jan 12, 2014 IP
  2. tolisd

    tolisd Banned

    Messages:
    224
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    do you have a robots.txt page under you www folder ?
    tolisd, Jan 18, 2014 IP