1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess redirection help

Discussion in 'Server Configuration and Hosting' started by wickedstangs, Sep 4, 2014.

  1. wickedstangs

    wickedstangs Well-Known Member

    Ok, I need some help, @Jake Bunce @Brogan I just noticed that google has wiped everything that is on my site from there search engine. Only visible is the url.

    I went from www.wickedstangs.com/community to www.wickedstangs.com

    Below is my code can someone give me a hand please
    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine On
      
        RewriteCond %{HTTP_HOST} ^wickedstangs\.com [NC]
            RewriteRule ^(.*)$ http://www.wickedstangs.com/$1 [R=301,L]
    
        #    If you are having problems with the rewrite rules, remove the "#" from the
        #    line that begins "RewriteBase" below. You will also have to change the path
        #    of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /xenforo
    
        #    This line may be needed to enable WebDAV editing with PHP as a CGI.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
            RewriteCond %{ENV:rwdone} !^yes$
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RedirectMatch 301 ^/community/?$ http://www.wickedstangs.com
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
        RewriteRule ^community/(.*)?$ /$1 [R=301,L]
    </IfModule>
    Google Search
    google.JPG
     
  2. wickedstangs

    wickedstangs Well-Known Member

    anyone...
     
  3. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    This should work:
    Code:
    RewriteEngine On
    RedirectMatch 301 /community/(.*) http://www.wickedstangs.com/$1
    
     
    Jake Bunce likes this.
  4. wickedstangs

    wickedstangs Well-Known Member


    Where exactly do I place it? Like Below?

    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine On
     
        RewriteCond %{HTTP_HOST} ^wickedstangs\.com [NC]
            RewriteRule ^(.*)$ http://www.wickedstangs.com/$1 [R=301,L]
    
        #    If you are having problems with the rewrite rules, remove the "#" from the
        #    line that begins "RewriteBase" below. You will also have to change the path
        #    of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /xenforo
    
        #    This line may be needed to enable WebDAV editing with PHP as a CGI.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
            RewriteCond %{ENV:rwdone} !^yes$
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
    RedirectMatch 301 /community/(.*) http://www.wickedstangs.com/$1
        RedirectMatch 301 ^/community/?$ http://www.wickedstangs.com
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
        RewriteRule ^community/(.*)?$ /$1 [R=301,L]
    </IfModule>
     
  5. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    I've updated the code for you:

    Code:
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RedirectMatch 301 /community/(.*) http://www.wickedstangs.com/$1
      RewriteCond %{HTTP_HOST} ^wickedstangs\.com [NC]
      RewriteRule ^(.*)$ http://www.wickedstangs.com/$1 [R=301,L]
    
      #  If you are having problems with the rewrite rules, remove the "#" from the
      #  line that begins "RewriteBase" below. You will also have to change the path
      #  of the rewrite to reflect the path to your XenForo installation.
      #RewriteBase /xenforo
    
      #  This line may be needed to enable WebDAV editing with PHP as a CGI.
      #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
      RewriteCond %{ENV:rwdone} !^yes$
      RewriteCond %{REQUEST_FILENAME} -f [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
      RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
     
    wickedstangs and Jake Bunce like this.
  6. wickedstangs

    wickedstangs Well-Known Member

    Wow, thank you very much going to try it out.. Seems to be working will find out in a couple of weeks...:) again thank you
     
  7. tommydamic68

    tommydamic68 Well-Known Member

    I will watch this closely. I was also thinking of doing this. If you don't mind, how did you go about going from the community folder to the root- was it complicated to do? Anything besides the .htacess file?
     
  8. wickedstangs

    wickedstangs Well-Known Member

    it wasn't complicated at all very easy but, I would not recommend it. I have been battling the .htaccess file issue for a long time and it has'nt been fine since. Hope fully @Mr. Goodie2Shoes will put things back to norm....

    https://xenforo.com/community/threa...need-to-modify-in-htaccess.80047/#post-807221

    https://xenforo.com/community/threads/moving-site-to-root.74907/
     
  9. tommydamic68

    tommydamic68 Well-Known Member

    Yeah- maybe not worth the headache I guess, hope it works out for you.
     

Share This Page