| Welcome to WebmasterWorld Guest from 126.96.36.199 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|.htaccess rule for directory urls|
How to redirect urls inside a directory
| 11:30 am on Sep 24, 2013 (gmt 0)|
I've vBulletin forum installed in /forum directory on a website.
I'm trying to redirect /forum/xyz/ to /forum/abc-xyz-def/
I tried this rules but none worked
In the .htaccess file of root
RewriteRule ^forum/xyz/ /forum/abc-xyz-def/ [L,R=301]
I also tried above in the /forum/.htaccess but still didn't work.
| 1:03 pm on Sep 24, 2013 (gmt 0)|
Prefix the target URL with the protocol and hostname.
Request the short URL and watch the browser address bar change the the longer URL.
The code goes in the root htaccess file.
| 7:43 pm on Sep 24, 2013 (gmt 0)|
Keep all RewriteRules in the primary htaccess. mod_rewrite behaves a little differently from other Apache mods, so you have to treat it with caution.
Before anything else: Does your existing htaccess have other RewriteRules that do work as intended? If you don't know, make up a nonsense rule like
RewriteRule foobar http://www.example.com/widget.html [R=301,L]
and make sure it works. (Look at browser's address bar, not at page content.)
Does the forum use a CMS that uses rewriting? If so, you need to find those rules and make sure your additions go in the right places and don't conflict with existing rules.
| 9:18 pm on Sep 24, 2013 (gmt 0)|
welcome to WebmasterWorld, jackjermey!
is that a specific "xyz" or a generic "xyz"?
in other words are you redirecting a specific path or do you need to capture part of the path from the Pattern to reuse in the Substitution string?
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved