Need Help to Redirect Mass URLS by .htaccess

Discussion in 'Apache' started by Masoud Yousefnejad, Feb 1, 2011.

  1. #1
    I'm newbie in this forum and also in apache world,

    I need help to redirect mass urls in new ones. I've study very useful tutorial about this but still can't redirect my urls correctly.

    I have url like
    http://www.domain.com/articles/video-audio/digital-camera/item/390-eyes-vs-camera
    and I want to change the "articles/video-auto" to something else like "home/av" the 390 is the id of page and eyes-vs-camera is the description for SEF

    I really appreciated for any kind advice.
     
    Masoud Yousefnejad, Feb 1, 2011 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    So you just want to replace "articles/video-auto" with "home/av" in the URL?
     
    mwasif, Feb 1, 2011 IP
  3. Masoud Yousefnejad

    Masoud Yousefnejad Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you for your reply

    Yes, and the rest of the url should be in redirected url I mean (390-eyes-vs-camera) this part is dynamic
     
    Masoud Yousefnejad, Feb 1, 2011 IP
  4. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Try this code (not tested)

    RewriteEngine On
    RewriteRule ^articles/video-audio/digital-camera/item/([0-9]+)-(.*)$ http://www.domain.com/home/av/digital-camera/item/$1-$2 [R=301,L]
    Code (markup):
     
    mwasif, Feb 1, 2011 IP
  5. Masoud Yousefnejad

    Masoud Yousefnejad Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Unfortunately this does not work.

    right now my .htacess redirect portion is something like this

    # RewriteBase /
    
    RewriteEngine On
    ########## Begin -  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|/[^.]*)$  [NC]
    RewriteRule (.*) index.php
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    #
    ########## End - Joomla! core SEF Section
     RewriteRule ^articles/hardware-news/notebook/item/([0-9]+)-(.*)$ http://www.zoomit.ir/articles/notebook/item/$1-$2 [R=301,L]
    
    Code (markup):
     
    Masoud Yousefnejad, Feb 1, 2011 IP
  6. Masoud Yousefnejad

    Masoud Yousefnejad Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Any advice?
     
    Masoud Yousefnejad, Feb 4, 2011 IP