Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

.htaccess and redirects - bit of php too...

  • 07-08-2005 08:58PM
    #1
    Closed Accounts Posts: 19,080 ✭✭✭✭


    I'd like to be able to have someone type like www.icecentral.com/donations into their browser and have them redirected to www.icecentral.com/forum/siteindex.php?go=donations

    I've tried this in .htaccess:
    RedirectMatch permanent ^/donations$ http://icecentral.com/forum/siteindex.php?go=donations
    
    and this:
    http%3A%2F%2Ficecentral.com%2Fforum%2Fsiteindex.php%3Fgo%3Ddonations
    
    But both give me 404 errors.

    Any suggestions ?


Comments

  • Registered Users, Registered Users 2 Posts: 95 ✭✭fractal


    In HTML:
    <meta
    http-equiv="refresh" content="0;URL=http://myurl/"&gt;

    in ASP:
    Response.Redirect "http://myurl&quot;

    in PHP:
    header("Location: http://myurl");

    Bear in mind if you do it serverside it must be the first think echo'd to the browser....


  • Registered Users, Registered Users 2 Posts: 6,652 ✭✭✭daymobrew


    ciaranfo wrote:
    I'd like to be able to have someone type like www.icecentral.com/donations into their browser and have them redirected to www.icecentral.com/forum/siteindex.php?go=donations
    I modified my httpd.conf (Apache 1.3.33) and added:
    Redirect /donations http://meserver.com/money/give.txt
    
    and this worked as expected.
    Do you really need the regex version (RedirectMatch) since you are matching a constant string?

    Is mod_alias loaded? (run 'httpd -l' to list compiled in modules, httpd.conf will tell you which ones are loaded at runtime)
    Does the access_log or error_log provide any additional information?


  • Closed Accounts Posts: 19,080 ✭✭✭✭Random


    Well, I managed to get this working.

    Fyi the solution was pretty simple :)
    Redirect /donations http://icecentral.com/forum/siteindex.php?go=donations
    


    Cheers for the advice along the way :)


  • Closed Accounts Posts: 19,080 ✭✭✭✭Random


    Well, further problems now...

    redirectlimitexceeded.jpg

    Bit odd, no? Suffice to say no cookies are blocked.

    My code in my .htaccess is now:
    Redirect /donations http://icecentral.com/forum/siteindex.php?go=donations
    
    Redirect /servers http://icecentral.com/forum/siteindex.php?go=servers
    
    Redirect /downloads http://icecentral.com/forum/siteindex.php?go=downloads
    
    Redirect /forum http://icecentral.com/forum/index.php
    

    Is any body else getting this error?
    ANy advice ?


  • Registered Users, Registered Users 2 Posts: 6,652 ✭✭✭daymobrew


    ciaranfo wrote:
    Redirect /donations http://icecentral.com/forum/siteindex.php?go=donations
    
    Redirect /servers http://icecentral.com/forum/siteindex.php?go=servers
    
    Redirect /downloads http://icecentral.com/forum/siteindex.php?go=downloads
    
    Redirect /forum http://icecentral.com/forum/index.php
    

    Is any body else getting this error?
    ANy advice ?

    When I went to http://icecentral.com/donations it correctly redirected me to the 'go=donations' page. I am using Mozilla 1.4 on Solaris. Same result in Firefox 1.0.4 on Solaris.
    I would expect the result to be the same on all browsers as the redirection is at the server end.

    Is there any chance that the last redirect (/forum -> /forum/index.php) is causing a circular reference? That redirect might be best put in as a DirectoryIndex:
    <Directory /filesystem/path/to/forum>
    DirectoryIndex index.php
    </Directory>
    


  • Advertisement
  • Closed Accounts Posts: 19,080 ✭✭✭✭Random


    Yeh, it turns out the /forum was causing an infinite loop or something. It's working fine without the /forum. cheers :)


Advertisement