Search code examples
urlbase-url

Rewriting my BASE URL - Vbulletin


I currently have a vbulletin forums that I coppied the theme of to another site to make an application.

with this at the top of the files:

<base href="http://example.com/forums/"/><!--[if IE]></base><![endif]-->

So I simply copied/pasted the source code then modified the body.

The problem here is I have a "submit.php" button and what it does it goes based upon the base url so it becomes http://example.com/forums/submit.php but I want it to do this instead: http://application.example.com/submit.php

If I change the BASEURL from the source code the theme won't work anymore and I'm trying to preserve the theme


Solution

  • If you use apache with mod_rewrite, you can create the .htaccess file in the root directory

    RewriteEngine on
    
    # Don't apply to URLs that go to existing files or folders.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # Only apply to URLs that aren't already under folder forums.
    RewriteCond %{REQUEST_URI} !^/forums/
    
    # Rewrite all those to insert /forums.
    RewriteRule ^(.*)$ /forums/$1
    

    Documentation http://httpd.apache.org/docs/2.0/misc/rewriteguide.html