The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirecting pages

Discussion in 'General Discussion' started by cheetahes, Jun 2, 2011.

  1. cheetahes

    cheetahes Guest

    Hello,

    First of all. I hope this is the right place that I post this.

    I'm interested in creating a new directory on my website. And move my other files from that folder, to the new folder. But this will mean that tons of people that visit my site, will get a "page not found" error. So I'm looking for someway to redirect my old users.

    So yea, I wondered if you could do something like, if a user goes to:
    http://mysite.com/cheetah_stuff/index.html, then he gets redirected to http://mysite.com/fobber/index.html
    http://mysite.com/cheetah_stuff/abc.html, then he gets redirected to http://mysite.com/fobber/abc.html
    http://mysite.com/cheetah_stuff/cat.html, then he gets redirected to http://mysite.com/fobber/cat.html
    http://mysite.com/cheetah_stuff/current_css_link.html, then he gets redirected to http://mysite.com/fobber/current_css_link.html
    http://mysite.com/cheetah_stuff/ekstern.html, then he gets redirected to http://mysite.com/fobber/ekstern.html
    http://mysite.com/cheetah_stuff/sliding_title.html, then he gets redirected to http://mysite.com/fobber/sliding_title.html

    I'm not interesting in setting this up for every single file that I got. As I got quite a lot. (Over 100)

    - My old folder on FTP is called "cheetah_stuff", I'm interested in changing it to "fobber"

    Is there an easy way to do this? My host is running cPanel 11.

    Thanks in advance! :)
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You could setup a redirection from mysite.com/cheetah_stuff to mysite.com/fobber so that each file in that folder will be redirected to the new location. This is done in cPanel > Redirects area.
     
  3. cheetahes

    cheetahes Guest

  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Yes, that is the area. You'd select the domain in the dropdown for "All Public Domains" since you only want one domain to do this not all of your domains (if you have others), then you'd type cheetah_stuff into the first box after that dropdown and fobber into the box next to "redirects to" text. After that, you'd click the "Save" button.
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you do not provide the full url to test it, it isn't possible to know if it is or isn't working.
     
  6. cheetahes

    cheetahes Guest

    Awh. Just didn't felt like sharing it with the whole world.
    Oh well. The thing I've crossed over is "thekks".

    So my current thing is: -removed links-
    Edit: Which should redirect to: -removed links-
     
    #7 cheetahes, Jun 2, 2011
    Last edited by a moderator: May 29, 2012
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Can you go into File Manager and copy the contents of your .htaccess file in public_html and post those here?
     
  8. cheetahes

    cheetahes Guest

    /public_html/.htaccess:
    Code:
    RewriteEngine on
    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    allow from all
    deny from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName cheetah.thekks.net
    AuthUserFile /home/cheetaht/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/cheetaht/public_html/_vti_pvt/service.grp
    
    RewriteCond %{HTTP_REFERER} !^http://cheetah.thekks.net/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://cheetah.thekks.net$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.cheetah.thekks.net/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.cheetah.thekks.net$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    
    RewriteCond %{HTTP_HOST} ^cheetah.thekks.net$ [OR]
    RewriteCond %{HTTP_HOST} ^www.cheetah.thekks.net$
    RewriteRule ^cheetah_stuff\/?$ "http\:\/\/cheetah\.thekks\.net\/fobber" [R=301,L]
    
    
     
  9. cheetahes

    cheetahes Guest

    .htaccess:
    Code:
    RewriteEngine on
    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    allow from all
    deny from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName cheetah.thekks.net
    AuthUserFile /home/cheetaht/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/cheetaht/public_html/_vti_pvt/service.grp
    
    RewriteCond %{HTTP_REFERER} !^http://cheetah.thekks.net/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://cheetah.thekks.net$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.cheetah.thekks.net/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.cheetah.thekks.net$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    
    RewriteCond %{HTTP_HOST} ^cheetah.thekks.net$ [OR]
    RewriteCond %{HTTP_HOST} ^www.cheetah.thekks.net$
    RewriteRule ^cheetah_stuff\/?$ "http\:\/\/cheetah\.thekks\.net\/fobber" [R=301,L]
    
    
    cheetah_stuff/.htaccess
    Code:
    RewriteEngine on
    Options -Indexes
     
  10. cheetahes

    cheetahes Guest

    Heh. I just noticed that, when I go directly to -removed links- I do get redirected to -removed links- - Awesome!
    But when I go to -removed links- I don't get redirected :/

    .htaccess:
    Code:
    RewriteEngine on
    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    allow from all
    deny from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName mydomain.com
    AuthUserFile /home/user/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/user/public_html/_vti_pvt/service.grp
    
    RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://mydomain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    
    RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.cheetah.thekks.net$
    RewriteRule ^cheetah_stuff\/?$ "http\:\/\/my\.domain\.com\/directory" [R=301,L]
    
    
    my_stuff/.htaccess:
    Code:
    RewriteEngine on
    Options -Indexes
     
    #11 cheetahes, Jun 2, 2011
    Last edited by a moderator: May 29, 2012
  11. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If my_stuff has its own .htaccess file, please remove the contents in that file by moving it.

    Next, try the following:

    Code:
    RewriteCond %{HTTP_HOST} ^my.domain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.my.domain.com$
    RewriteRule ^my_stuff/(.*)$ directory/$1 [R=301,L]
    If that still doesn't work, take off the domain portion and just try this:

    Code:
    RewriteRule ^my_stuff/(.*)$ directory/$1 [R=301,L]
     
  12. cheetahes

    cheetahes Guest

    Still doesn't work.
    Now -removed links- redirects me to -removed links-
     
    #13 cheetahes, Jun 2, 2011
    Last edited by a moderator: May 29, 2012
  13. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What did you specifically put into the .htaccess. Did you try both of them?
     
  14. cheetahes

    cheetahes Guest

    I tried both. It currently looks like this:
    Code:
    RewriteEngine on
    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    allow from all
    deny from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName my.domain.com
    AuthUserFile /home/user/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/user/public_html/_vti_pvt/service.grp
    
    RewriteCond %{HTTP_REFERER} !^http://my.domain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://my.domain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.my.domain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.my.domain.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    
    RewriteRule ^my_stuff/(.*)$ directory/$1 [R=301,L]
     
    #15 cheetahes, Jun 2, 2011
    Last edited by a moderator: May 29, 2012
  15. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Since those are dynamic urls (which weren't mentioned originally but static pages), I'm not entirely certain why it is doing that, but try the full url then for the redirect:

    Code:
    RewriteRule ^my_stuff/(.*)$ http\:\/\/my\.domain\.com\/directory/$1 [R=301,L]
     
  16. cheetahes

    cheetahes Guest

    Man! You are awesome! It works all great now :)
     
  17. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Cool, great to hear :)
     
  18. cheetahes

    cheetahes Guest

    Hm. When I was trying out the re-director, I set /http://my.domain.com/ to link to /http://www.google.dk/ - I removed this again, but it still links to that site! :S
    Is there anyway I can make /http://my.domain.com/ link to /http://my.domain.com/directory/index.html ? :)

    Edit: It doesn't do this in my other browser. I assume it has just cached the information. Sorry for bothering! :)
     
    #19 cheetahes, Jun 3, 2011
    Last edited by a moderator: Jun 3, 2011
Loading...

Share This Page