Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2002
    Location
    Toronto, Canada
    Posts
    11,059

    How to redirect 100+ pages in one shot?

    Is there any way to redirect 100+ pages in one shot on a cpanel box? I could go into cPanel and manually redirect each page individually, but that is a lot of work. Any way to do it in one step? I prefer to find a way in my browser, but if I have to do it in shell, so be it.

    TIA for your help.

    Vito
    DemoDemo.com - Flash tutorials since 2002
    DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  2. #2
    Join Date
    Jan 2002
    Location
    Toronto, Canada
    Posts
    11,059
    Hmm. Just wondering. Tell me if this would work. What if I use a global search and replace program to add the following to each of the pages to be redirected:

    <meta http-equiv="refresh" content="0; url=http://example.com/">

    and then upload to the site to overwrite the old files.

    Vito
    DemoDemo.com - Flash tutorials since 2002
    DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  3. #3
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,750
    It will be always easy to do it from shell when there are more numbers. You can edit the .htaccess file from the shell. If there is any particular patters for the names of the files, it would be much easier. If you can supply more details, we can help you better.
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

  4. #4
    Join Date
    Jan 2002
    Location
    Toronto, Canada
    Posts
    11,059
    Thanks David. Let's say all of the names of the pages to be redirected start with t_ . For example, t_page1.html. So I would need t_page1.html to t_page100.html to be redirected to newpage.html.

    Vito
    DemoDemo.com - Flash tutorials since 2002
    DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  5. #5
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,750
    You can use the following line of code.

    Code:
    for i in `seq 1 100`; do echo "Redirect /t_page$i /newpage.html" ; done >> /path/to/.htaccess
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

  6. #6
    Join Date
    Jan 2002
    Location
    Toronto, Canada
    Posts
    11,059
    Sorry, I was just using page 1 and page 100 as examples. They all start with t_ but then they all have different names, not sequential numbers.

    Take a look at the second post in this thread. I just tried doing a search and replace and was able to add a redirect to all the pages. So seemingly, all I have to do is upload the 100 pages and I'm done.

    For SEO purposes, I wonder which way is better. A lot of the t_ pages are entry pages to my site coming from google. Would there be any difference between methods here if I want to try to retain the SE traffic?

    Vito
    DemoDemo.com - Flash tutorials since 2002
    DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

Similar Threads

  1. htaccess redirect site pages...
    By acctman in forum Hosting Security and Technology
    Replies: 3
    Last Post: 04-25-2009, 02:21 PM
  2. Should I use a 301 redirect on thousands of pages?
    By lexington in forum SEO / SEM Discussions
    Replies: 11
    Last Post: 05-03-2008, 05:53 AM
  3. 404 pages - redirect?
    By Yoggi in forum Web Design and Content
    Replies: 2
    Last Post: 11-25-2006, 07:44 PM
  4. Redirect all pages script?
    By Johnburk in forum Programming Discussion
    Replies: 11
    Last Post: 06-23-2005, 07:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •