301 Redirect Matching first characters of URL using .htaccess

Discussion in 'Apache' started by syedusmanahmed, Jun 12, 2013.

  1. #1
    I want to redirect all the URLs starting from specific characters.

    For instance:
    www.example.com/abc-apple
    www.example.com/abc-bat.html
    www.example.com/abc-cat.php
    .......
    .......

    All of the URLs above starts with "abc-" I want a redirect code to redirect all URLs starting from "abc-" to a single URL i.e. www.example.com/all
     
    syedusmanahmed, Jun 12, 2013 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    The following code should work

    RewriteEngine On
    RewriteRule ^abc-(.*) /newpage.php [R=301,L]
    Code (markup):
     
    RoseHosting, Jun 14, 2013 IP
    Arick unirow likes this.