Msg#: 4235995 posted 4:30 pm on Nov 26, 2010 (gmt 0)
Hi, I'm trying to make a 301 redirect so anything /FORUM-BLOG/*.* would get redirected to a different dir. I would like to use a sub domain that is diyforum.askmediy.com is there anyway to make it like a wildcard . So anything that comes in after /FORUM-BLOG/ would just get redirected.
there are many threads covering that subject in the Apache Web Server forum at WebmasterWorld. this one might be close to your solution - .htaccess to redirect /directory/ to subdomain: http://www.webmasterworld.com/apache/4116291.htm [webmasterworld.com]
Msg#: 4235995 posted 11:27 pm on Dec 1, 2010 (gmt 0)
You need to understand the code before you can use it or modify it. See the resources cited in our Apache forum charter and the examples in our Apache Forum Library.
If you remove "blog/" from the RewriteRule pattern, it will redirect *all* requests to blog.example.com. However, be very sure that that is really what you want, because it will make the originally-requested domain inaccessible.
Msg#: 4235995 posted 1:29 am on Dec 7, 2010 (gmt 0)
The parentheses in the rules above capture the "whatever else follows 'blog' value" and the $1 in the substitution URL "copies" that captured value. So this is a many-to-many rule, and not a many-to-one rule at all.
You have to read the RewriteRule and regular expressions documentation (see our Apache Forum Charter for links) at a bare minimum to understand this stuff, and proceeding without understand --and thorough understanding, at that-- can reasonably be termed "suicide" at worst and "potentially very expensive" at best. One little logic error, omission, or typo can utterly sink your site -- functionally, search-ranking-wise, or both.
Msg#: 4235995 posted 8:09 am on Dec 10, 2010 (gmt 0)
The usage of .* pattern in parentheses and the $1 backreference means that it handles EVERY request arriving at the site, so no there is no need to make a redirect for each URL. The code already does that.