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
Code:
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:
myurl.com: The Leading Domain Names Site on the Net

And the new mod rewrite is

Code:
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

myurl.com: 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

    <html><head>
    <meta http-equiv="refresh" content="0;url=http://www.yourURL.com/">

    </head></html>

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

    -- Lisa G

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

    Code:
    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
      Signature
      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

    Dave
    {{ 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 domainn.com/new-url
    But with my current settings, this does not work and redirects me to something like this:
    Redirect /old-url.php domain.com/new-url?q=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.
    {{ DiscussionBoard.errors[963920].message }}

Trending Topics