How can I redirect my old urls to new urls

8 replies
I want to redirect old urls to new urls how can I do this?

This is the old mod rewrite I am using
RewriteRule ^([A-Za-z0-9_-]*)-([0-9]*)-([0-9]*)-([0-9]*)-(.*).html$  article.php?categoryname=$1&catid=$2&id=$3&views=$4&title=$5 [L,NC]
Example url: The Leading Domain Names Site on the Net

And the new mod rewrite is

RewriteRule ^([A-Za-z0-9_-]*)-([0-9]*)-([0-9]*)-([0-9]*)/(.*).html$  article.php?categoryname=$1&catid=$2&id=$3&views=$4&title=$5 [L,NC]
example of New URL format to be redirected the old url is The Leading Domain Names Site on the Net

Thanks for the help
#red #redirect #urls
  • Profile picture of the author hotscode
    what you mean about redirect? are its like this

    <meta http-equiv="refresh" content="0;url=">


    {{ DiscussionBoard.errors[946033].message }}
  • Profile picture of the author lisag
    What's not working?

    -- Lisa G

    {{ DiscussionBoard.errors[946695].message }}
  • Profile picture of the author ziffgone
    You might have to escape that forward slash:

    RewriteRule ^([A-Za-z0-9_-]*)-([0-9]*)-([0-9]*)-([0-9]*)\/(.*).html$  article.php?categoryname=$1&catid=$2&id=$3&views=$4&title=$5 [L,NC]
    {{ DiscussionBoard.errors[949875].message }}
    • Profile picture of the author Jeremy Morgan
      ziffgone is right, you do need to escape it.

      Also, if you want to preserve your previously crawled pages in search engines, you should consider using a 301 redirect as well.

      redirect 301 /oldfolder/oldfile.htm /newfolder/newfile.htm
      Jeremy Morgan, Software Developer / SEO
      Check out my Programming Blog for news, tips, and tutorials
      {{ DiscussionBoard.errors[950022].message }}
  • Profile picture of the author GetStreetSmart
    just go to godaddy or whereever you got your domain and select the re-direct option. It is easy, only takes a few minutes and happens ususally within the hour.

    Hope this helps

    {{ DiscussionBoard.errors[950110].message }}
  • Profile picture of the author zain654321
    I have a simple question, regarding the .htacces in Drupal. I want to redirect my users from my old URLs (from the time before I used drupal) to the new URLs in Drupal. Generally I use the following:
    Redirect /old-url.php
    But with my current settings, this does not work and redirects me to something like this:
    Redirect /old-url.php
    # Rewrite current-style URLs of the form 'index.php?q=x'.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    BUT: I cannot change this rule, otherwise my website does not work properly anymore. Does anyone know, what I can do, to redirect my visitors (and search engines) from my old URL to the new URL without changing this exact and important URL??
    Any Idea and Help Is Highly Appreciated!!!
    Thank you very much!
    {{ DiscussionBoard.errors[960590].message }}
  • Profile picture of the author PONTING
    Ohh, I was looking for this code. I have used my cpanel but did not find this code so that I can create a page with ads which will redirect to another page after a time. Thank you so much for your kind support.
    {{ DiscussionBoard.errors[962821].message }}
  • Profile picture of the author nitinjain
    If you are using regex in your page means then you can set the redirect value to true and can use the orginal url and the old url into the rewrite syntax.

    Work for yourself not for the company.

    Real Estate in Mumbai | Mumbai Property | Mumbai Real Estate

    {{ DiscussionBoard.errors[963920].message }}

Trending Topics