Welcome to WebmasterWorld Guest from 54.145.117.164

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess rule for directory urls

How to redirect urls inside a directory

     
11:30 am on Sep 24, 2013 (gmt 0)



Hi All,
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.

any suggestion?
1:03 pm on Sep 24, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



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)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month