[CODE4LIB] Apache URL redirect
Hi - I'm new to Apache and hope that someone out there might be able to help me with a configuration issue over at San Jose Public Library. I need to have the URL www.partnersinreading.org redirect to http://www.sjpl.org/par Right now if you go to www.partnersinreading.org it takes you to the root, sjpl.org and then if you navigate through the site all the urls are rewritten with partnersinreading as the root. That's no good. I went into Apache's httpd.conf file and added in the mod_alias area: Redirect permanent http://www.partnersinreading.org/ http://www.sjpl.org/par I'm assuming this is not a DNS issue... This isn't the right approach. Any input would be appreciated, its rather unnerving to have no experience with this and be expected to make it work. -- Nate Hill nathanielh...@gmail.com http://www.natehill.net
Re: [CODE4LIB] Apache URL redirect
Redirect does not look the hostname, just the path I think you have two options; 1) set up a named based virtual host for www.partnersinreading.org In that name based virtual host, set up your Redirect / http://www.sjpl.org/par 2) if you are using mod_rewrite, you could do something like this. RewriteCond %{HTTP_HOST} ^.*partnersinreading\.org$ RewriteRule ^/(.*)$ http://www.sjpl.org/par$1 [R,NE] hope that helps, -- Brian On Thu, Feb 3, 2011 at 1:42 PM, Nate Hill nathanielh...@gmail.com wrote: Hi - I'm new to Apache and hope that someone out there might be able to help me with a configuration issue over at San Jose Public Library. I need to have the URL www.partnersinreading.org redirect to http://www.sjpl.org/par Right now if you go to www.partnersinreading.org it takes you to the root, sjpl.org and then if you navigate through the site all the urls are rewritten with partnersinreading as the root. That's no good. I went into Apache's httpd.conf file and added in the mod_alias area: Redirect permanent http://www.partnersinreading.org/ http://www.sjpl.org/par I'm assuming this is not a DNS issue... This isn't the right approach. Any input would be appreciated, its rather unnerving to have no experience with this and be expected to make it work. -- Nate Hill nathanielh...@gmail.com http://www.natehill.net
Re: [CODE4LIB] Apache URL redirect
On Feb 3, 2011, at 4:42 PM, Nate Hill wrote: Hi - I'm new to Apache and hope that someone out there might be able to help me with a configuration issue over at San Jose Public Library. I need to have the URL www.partnersinreading.org redirect to http://www.sjpl.org/par Right now if you go to www.partnersinreading.org it takes you to the root, sjpl.org and then if you navigate through the site all the urls are rewritten with partnersinreading as the root. That's no good. I went into Apache's httpd.conf file and added in the mod_alias area: Redirect permanent http://www.partnersinreading.org/ http://www.sjpl.org/par But the argument to match for redirecting is the local path, not the URL, so you'll have to either do some environmental matching, or put it in a virtual host block I'm used to mod_rewrite, so I'd probably do something like: RewriteCond %{HTTP_HOST} ^www\.partnersinreading\.org$ RewriteRule ^/(.*) http://www.sjpl.org/par/$1 [L,R=301] (that assumes that you've replicated the directory structure on the new site) - Joe Hourcle Programmer/Analyst Solar Data Analysis Center Goddard Space Flight Center
Re: [CODE4LIB] Apache URL redirect
Thank you for your responses... Virtual host setup was also on the agenda, guess both things have to happen at the same time. With any luck I'll have this sorted out soon. Nate On Thu, Feb 3, 2011 at 2:04 PM, Joe Hourcle onei...@grace.nascom.nasa.govwrote: On Feb 3, 2011, at 4:42 PM, Nate Hill wrote: Hi - I'm new to Apache and hope that someone out there might be able to help me with a configuration issue over at San Jose Public Library. I need to have the URL www.partnersinreading.org redirect to http://www.sjpl.org/par Right now if you go to www.partnersinreading.org it takes you to the root, sjpl.org and then if you navigate through the site all the urls are rewritten with partnersinreading as the root. That's no good. I went into Apache's httpd.conf file and added in the mod_alias area: Redirect permanent http://www.partnersinreading.org/ http://www.sjpl.org/par But the argument to match for redirecting is the local path, not the URL, so you'll have to either do some environmental matching, or put it in a virtual host block I'm used to mod_rewrite, so I'd probably do something like: RewriteCond %{HTTP_HOST} ^www\.partnersinreading\.org$ RewriteRule ^/(.*) http://www.sjpl.org/par/$1 [L,R=301] (that assumes that you've replicated the directory structure on the new site) - Joe Hourcle Programmer/Analyst Solar Data Analysis Center Goddard Space Flight Center -- Nate Hill nathanielh...@gmail.com http://www.natehill.net
Re: [CODE4LIB] Apache URL redirect
On Feb 3, 2011, at 5:21 PM, Nate Hill wrote: Thank you for your responses... Virtual host setup was also on the agenda, guess both things have to happen at the same time. You don't have to set up virtual hosts with the method that both Brian and I mentioned, although the syntax is a little more confusing for people who might not be used to mod_rewrite. You only need virtual hosts if you want your method (Redirect) to work: NameVirtualHost * VirtualHost * ServerName www.partnersinreading.org DocumentRoot /set/to/point/somewhere/ Redirect permanent / http://www.sjpl.org/par /VirtualHost -Joe