You are not logged in.
#1 2005-10-21 10:57:27
- tamlyn
- Lead Developer

Apache mod_alias
Could someone with a better grasp of Apache mod_alias than I please tell me why the following doesn't work.
I want to redirect requests such as http://singapore.sourceforge.net/forum/ … .php?t=528 to http://www.sgal.org/forum/viewtopic.php?id=528 so that links to specific topics on the old forum will carry through to the new one. My .htaccess file in the web root of the sf.net site looks like this:
Code:
RedirectMatch /forum/viewtopic\.php\?t=([0-9]+) http://www.sgal.org/forum/viewtopic.php?id=$1 Redirect permanent / http://www.sgal.org/
The 'Redirect' works fine but the 'RedirectMatch' doesn't match anything even if I remove the 'Redirect'. Any ideas?
Offline
#2 2005-10-21 20:18:49
- pao
- Member

Re: Apache mod_alias
Code:
RedirectMatch permanent t=([0-9]*)$ http://www.sgal.org/forum/viewtopic.php/id=$1
?
Patrick O'Leary
singapore gallery: [url=http://patrick.greentaperacing.us/gallery/]Missing the Gallery[/url]
Offline
#4 2005-10-21 23:05:51
- pavian
- Moderator

Re: Apache mod_alias
http://httpd.apache.org/docs/2.1/mod/mod_alias.html wrote:
mod_alias is designed to handle simple URL manipulation tasks. For more complicated tasks such as manipulating the query string, use the tools provided by mod_rewrite.
![]()
Offline
#5 2005-10-21 23:31:25
- pavian
- Moderator

Re: Apache mod_alias
I just thought about this.. couldn't you just Redirect it from sourceforge.net to sgal.org, but to lets say sgal.org/form/external.php
In external php you call a header function which redirects the user to the correct topic.
Offline
#6 2005-10-22 03:14:19
- tamlyn
- Lead Developer

Re: Apache mod_alias
I tried using mod_rewrite too, both on the sf.net servers and on the local server too. No luck. I think I'm just cursed.
Offline
#7 2005-10-23 01:20:49
- pao
- Member

Re: Apache mod_alias
Hack the forum script to make the GET variable id equal to the variable t, if it exists, and use the simple redirect?
Patrick O'Leary
singapore gallery: [url=http://patrick.greentaperacing.us/gallery/]Missing the Gallery[/url]
Offline
#8 2005-10-24 17:19:27
- tamlyn
- Lead Developer

Re: Apache mod_alias
Yeah I suppose that would work but I feel disempowered by mod_alias's lack of obedience. DO AS YOU'RE TOLD DAMMIT! I think it must be a probelm with me regexp since it doesn't work in mod_rewrite either.
Offline
#10 2005-10-24 23:40:27
- tamlyn
- Lead Developer

Re: Apache mod_alias
Got it! The query string is not treated as part of the URL so you can't include it in the pattern. Thanks to Adult Webmaster Info (and Google!) for providing the answer.
Offline
#11 2005-10-24 23:40:42
- pao
- Member

Re: Apache mod_alias
Remember, kids: Apache loves you.
Patrick O'Leary
singapore gallery: [url=http://patrick.greentaperacing.us/gallery/]Missing the Gallery[/url]
Offline
#12 2005-11-24 23:49:29
- MrPete
- Member
Re: Apache mod_alias
tamlyn, check out kodos, it's a regex debugger written for python, but it works with anything that adheres to the PCRE standard (like php
)
http://kodos.sourceforge.net/
Offline