.htaccess rewrite help

3 replies
So here is my situation.

I just upgraded vbulleten to the new vb with CMS. Now my old cms doesn't work, and I don't want it to, but the problem is that people used to be able to go to exmaple.com, and the cms gave them options to go to the forum or other pages.

Now the built in CMS is in the /forums directory, and people are used to going to the root domain.

So i need to forward all people from example.com to example.com/forums for things to work, but then I loose PR on my original page, so I want to rewrite /forums to the root

So when you access the site you see the forums in /forums but the url remains as example.com

If anyone can help that would be great......Thanks
#htaccess #rewrite
  • Profile picture of the author cyphix
    You shouldn't lose your PR if you use a 301 (permanent) redirect AFAIK.

    redirect 301 old_url.html newurl.com

    As for your other question...

    If you want to rewrite a URL to another but keep the old URL in the location bar use this..

    Code:
    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
    RewriteRule ^cms.php /forum/cms.php
    The "Options +FollowSymlinks" is optional & basically just tells it to follow symlinks... you probably don't need to worry about that so you can leave it out.

    The "RewriteBase /" controls where you are rewriting from..... basically it's like appending whatever you put there to the URL you are rewriting..... so for example:

    RewriteBase /

    ...becomes..

    RewriteRule ^/cms.php /forum/cms.php

    OR

    RewriteBase /123/

    ...becomes..

    RewriteRule ^/123/cms.php /forum/cms.php

    Let me know if that works for you!
    {{ DiscussionBoard.errors[2645025].message }}
    • Profile picture of the author rednimer
      Thanks for the info....

      I found a different solution so I wasn't able to test this though.

      Apparently vbulletin was already prepared for this, and allows you to move the index.php to the root directory, and just make a small change in the file to point to your forum.
      {{ DiscussionBoard.errors[2646458].message }}
      • Profile picture of the author cyphix
        OK great - good to hear you got it sorted out anyway!
        {{ DiscussionBoard.errors[2646465].message }}

Trending Topics