0
Welcome Guest! Login
0 items Join Now

Redirect http://yoursite.com to http://www.yoursite.com

    • guysmiley's Avatar
    • guysmiley
    • Sr. Rocketeer
    • Posts: 160
    • Thanks: 2

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 7 months ago
    • Interesting.

      I don't see this happending in j152 when I turn on default seo.
      Settings:
      SEF URLs: On
      Apache mod_rewrite: On

      Any idea why this is?
    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 7 months ago
    • Well this script is idendant of joomla, you put it in .htaccess in the root of your site?
    • guysmiley's Avatar
    • guysmiley
    • Sr. Rocketeer
    • Posts: 160
    • Thanks: 2

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 7 months ago
    • Yes, .htaccess is in the root of my joomla site and, yes, this is where I added the code above.
    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 7 months ago
    • could you PM the contents of your htaccess file, and the exact name of the file, and the confirm that is is in the root of public_html?
    • guysmiley's Avatar
    • guysmiley
    • Sr. Rocketeer
    • Posts: 160
    • Thanks: 2

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 7 months ago
    • Thanks, Lucky.

      PM sent.
    • ProtoPC's Avatar
    • ProtoPC
    • Hero Rocketeer
    • Posts: 289
    • Thanks: 0

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 1 week ago
    • I have always added those 2 lines to my Joomla 1.0.x templates and they have worked fine adding in the http://www....and they still do. (Switching domain.com out of course)

      But now that I am starting to tinker with the Joomla 1.5.x sites I have yet to get that rewrite to work...using the same linux server. Other than turning on Search Engine Friendly URLs and Use Apache mod_rewrite. What else am I missing?

      Tried:
      RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
      RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

      And:
      rewritecond %{http_host} ^domain.com [nc]
      rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

      Any suggestions why those two lines only work in my Joomla 1.0.x sites?
      ##
      # @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
      # @package Joomla
      # @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
      # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
      # Joomla! is Free Software
      ##
       
       
      #####################################################
      #  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
      #
      # The line just below this section: 'Options +FollowSymLinks' may cause problems
      # with some server configurations.  It is required for use of mod_rewrite, but may already
      # be set by your server administrator in a way that dissallows changing it in
      # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
      # beginning of line), reload your site in your browser and test your sef url's.  If they work,
      # it has been set by your server administrator and you do not need it set here.
      #
      #####################################################
       
      ##  Can be commented out if causes errors, see notes above.
      Options +FollowSymLinks
       
      #
      #  mod_rewrite in use
       
      RewriteEngine On
       
      ########## Begin - Rewrite rules to block out some common exploits
      ## If you experience problems on your site block out the operations listed below
      ## This attempts to block the most common type of exploit `attempts` to Joomla!
      #
      # Block out any script trying to set a mosConfig value through the URL
      RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
      # Block out any script trying to base64_encode crap to send via URL
      RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
      # Block out any script that includes a <script> tag in URL
      RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
      # Block out any script trying to set a PHP GLOBALS variable via URL
      RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
      # Block out any script trying to modify a _REQUEST variable via URL
      RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
      # Send all blocked request to homepage with 403 Forbidden error!
      RewriteRule ^(.*)$ index.php [F,L]
      #
      ########## End - Rewrite rules to block out some common exploits
       
      #&nbsp; Uncomment following line if your webserver's URL
      #&nbsp; is not directly related to physical file paths.
      #&nbsp; Update Your Joomla! Directory (just / for root)
       
      # RewriteBase /
       
       
      ########## Begin - Joomla! core SEF Section
      #
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/index.php
      RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$&nbsp; [NC]
      RewriteRule (.*) index.php
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
      #
      ########## End - Joomla! core SEF Section
       
       
      RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
      RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
    • Herbal Natural Remedies | Get Paid Advertising 3 Minutes A Day!
    • Ben Lee's Avatar
    • Ben Lee
    • Elite Rocketeer
    • Posts: 4193
    • Thanks: 42

    Re: Redirect http://yoursite.com to http://www.yoursite.com

    Posted 16 years 5 days ago
    • I've used this post's answer for my 1.5 sites and it's worked fine. Take not of the "Rewrite Engine On" lines and also read the basic Joomla 1.5 htaccess file and you'll find in the header a line that says to uncomment it or comment it out if it's not working.
      ##&nbsp; Can be commented out if causes errors, see notes above.
      Options +FollowSymLinks
      This is stuff that depends on your server configuration.

      Here's the link to the original post where you'll find a little more info, but I'm quoting it here as the title of the thread makes it fitting and hopefully people will search and find what they need.
      http://www.rockettheme.com/forum/index.php?t=31561&rb_v=viewtopic#p165540
      Djamil Legato wrote:
      Ajax cannot performs remote requests, so if your server is not configured to redirect from domain to "www." or vice-versa, Chromatophore will consider as valid URL the $template_path you've configured.

      To make it redirect, I'd suggest to try adding at top of .htaccess in the root directory (if already exists) or create it as new and add one of the two following options, based on your need:

      1. Redirect from domain to www.domain :
      RewriteEngine On
      RewriteBase /
      RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
      RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]



      2. Redirect from www.domain to domain:
      RewriteEngine On
      RewriteBase /
      RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
      RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

      Thanks to Djamil for this solution!
    • Last Edit: 16 years 5 days ago by Ben Lee.

Time to create page: 0.057 seconds