Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts

    create a redirect of file extension in htaccess

    I am in desperate need of creating a redirect in my wordpress htaccess.

    I have thousands of images that gives an 404 error in google webmaster tools.

    Basically I need to write a redirect in my worpress htaccess for the following file extension:

    http://mydomain.com/category-base/post/image-category/image-number

    I want the htaccess to only pick up the last bit of the url... so from /image-category/ and forward to all the numbered images...

    Can anyone help me write this string as I am totally confused of how it works. Please, please, please!!

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    75
    Thanks
    1
    Thanked 2 Times in 2 Posts
    This is an apache issue. I don't think it belongs in the PHP forums. Correct me if I'm wrong.

  • #3
    New Coder
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Thumbs up

    Ok, Thanks I will repost it in Apache.

  • #4
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I had the same problem like you. But i fixed them. Here are the solutions i'm using for my website giup viec nha and tạp vụ văn phòng. Check them out.


    Code:
    Example 1 - Redirect from oldexample.com to www.newexample.com:
    RewriteEngine On
            RewriteCond %{HTTP_HOST} !oldexample.com$ [NC]
            RewriteRule ^(.*)$ http://www.newexample.com/$1 [L,R=301]
    This is useful when you use www.newexample.com as your new domain name (see also this article about redirecting www and non-www domains). If not - use the code of example 2.
    
    Example 2 - Redirect from oldexample.com to newexample.com:
    RewriteEngine On
            RewriteBase /
            RewriteCond %{HTTP_HOST} !oldexample.com$ [NC]
            RewriteRule ^(.*)$ http://newexample.com/$1 [L,R=301]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •