.htaccess and 301 Redirect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Moren
    Registered User
    • May 2005
    • 20

    #1

    .htaccess and 301 Redirect

    Hi
    I try to do some redirection, I want to redirect all blog post from my sub-domain ( but not from main sub-domain page) to my domain category page.

    sub.domain.com/all-post/ to domain.com/category/

    (or even better to domain.com/category/random-post/ - but I don't believe that is possible... )

    And I want to keep the main page of my sub-domain.

    Thanks!
  • PornCious
    Registered User
    • Nov 2012
    • 50

    #2
    did you try this www htaccessredirect dot net

    Comment

    • Moren
      Registered User
      • May 2005
      • 20

      #3
      I do not get what I need...

      Comment

      • PornCious
        Registered User
        • Nov 2012
        • 50

        #4
        Following is the basic redirection. However, looks like you need multiple filtration which should not be impossible...
        Code:
        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^sub.yourdomain.com$
        RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
        Try asking an apache expect in stackexchange or stackoverflow.

        You will need one adddition line like RewriteCond %{REQUEST_URI} before rewrite rule.

        Comment

        • David-PD
          Confirmed User
          • Nov 2013
          • 234

          #5
          If u want to redirect to random post u need to use php or any other lang ur using.

          PornDeals.com - WebcamDeals.com - GayDeals.com - PornCoupons.com new!

          david{att}porndeals{dott}com (email)
          porndeals.d (skype)

          --

          Looking for HQ hardlinks in all niches!!!

          --

          Looking to buy websites with income & stable traffic! Contact me if you have something interesting

          Comment

          • Barry-xlovecam
            It's 42
            • Jun 2010
            • 18083

            #6
            Code:
            301 Redirect Entire Directory ^
            
            RedirectMatch 301 /blog(.*) http://www.askapache.com/$1
            try out in that sub domain's .htaccess

            Code:
            RedirectMatch 301 /all-post(.*)  http://domain.com/category/$1
            http://www.askapache.com/htaccess/htaccess.html if the above won't work read the code posts here.

            Comment

            • Moren
              Registered User
              • May 2005
              • 20

              #7
              I buy on fiverr for 5$ this htaccess code, and it is working for me:

              Code:
              RewriteCond %{HTTP_HOST} ^boobs\.domain\.c o m [NC]
              RewriteCond %{REQUEST_URI} ^/([0-9]{4})/([0-9]{2})/([^/]+)/$
              RewriteRule (.+) h t t p://domain.c o m/category/boobs-busty/ [R=301,L]

              Comment

              • PornCious
                Registered User
                • Nov 2012
                • 50

                #8
                Originally posted by Moren
                I buy on fiverr for 5$ this htaccess code, and it is working for me:

                Code:
                RewriteCond %{HTTP_HOST} ^boobs\.domain\.c o m [NC]
                RewriteCond %{REQUEST_URI} ^/([0-9]{4})/([0-9]{2})/([^/]+)/$
                RewriteRule (.+) h t t p://domain.c o m/category/boobs-busty/ [R=301,L]

                i knew about REQUEST_URI but couldn't figure it out. lol thanks for sharing with us! it might save 5 bucks for many.

                Comment

                Working...