.htaccess redirect url question

2 replies
I have updated a script and I want to use the .htaccess
file to redirect old URLs to the new URL.

The old URLs were being directed through the .htaccess
file with this line of code:

^Art/([0-9]+)/([0-9]+)/.*\.html$ articledetail.php?artid=$1&catid=$2 [L]

and the new script .htaccess now uses this code

^Article/([0-9]+)/(.*)\.html$ articledetail.php?artid=$1&title=$2 [L]

So I want to redirect anyone coming to the site with the old code URL to the
new code URL.

Any help with how to do this with the .htaccess or otherwise
would be much appreciated.

Thanks

Terry
#htaccess #question #redirect #url
  • Profile picture of the author Tim Brownlaw
    Well as a quick fix you could try this...

    Have both in your htaccess file and change your old...

    PHP Code:
    ^Art/([0-9]+)/([0-9]+)/.*.html$  articledetail.php?artid=$1&catid=$[L
    to

    PHP Code:
    ^Art/([0-9]+)/([0-9]+)/.*.html$  articledetail.php?artid=$1&title=$[L
    So you'll catch the old .../art/.... and redirect to the script with the new term ( title ) and also catch the .../article/...

    Give that a shot and try it out using both URL forms...

    Cheers
    Tim
    {{ DiscussionBoard.errors[5454583].message }}
    • Profile picture of the author terry1288
      Hi Tim

      Thanks for your suggestion.

      I can't actually see any difference in the line you say change from
      this code to this code.

      I can't also see anything reflecting the new term Article.

      Could you explain a little more please.

      Thanks

      Terry
      {{ DiscussionBoard.errors[5455476].message }}

Trending Topics