Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

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

Options
  • 07-08-2005 8: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 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 Posts: 6,508 ✭✭✭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 Posts: 6,508 ✭✭✭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