Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite, conditional RewriteBase?
#1

[eluser]Anthony Linton[/eluser]
Hi everyone,

I'm having trouble with my .htaccess file. Here it is as it stands.

Code:
#http://codeigniter.com/wiki/mod_rewrite/
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ps3vs360/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

This works fine.

My problem is that during development I'm working at http://localhost/ps3vs360/ and then deploying it to my production server at http://ps3vs360.com/

Normally, this wouldn't be a problem. I could just set RewriteBase /ps3vs360/ on the local system and change it to RewriteBase / via FTP on the server. However, I've recently started using subversion which means the files must be identical on both my local server and the remote server or it'll moan at me.

You can see the problem if you go to http://ps3vs360.com/quiz/, I get 500 Internal Server Error. I definitely have mod_rewrite enabled on the server etc so it is working ok, see here for my server settings: http://ps3vs360.com/phpinfo.php so it must be the RewriteBase.

Is there a way for me to check if it's localhost, and if so, use the directory /ps3vs360/ and if not use RewriteBase / ? I've googled for a solution to this and can't find one, and I suck at htaccess conditions.

Thank you Smile


Messages In This Thread
mod_rewrite, conditional RewriteBase? - by El Forum - 12-17-2009, 04:09 PM
mod_rewrite, conditional RewriteBase? - by El Forum - 12-17-2009, 05:14 PM
mod_rewrite, conditional RewriteBase? - by El Forum - 12-17-2009, 05:36 PM
mod_rewrite, conditional RewriteBase? - by El Forum - 12-17-2009, 06:16 PM
mod_rewrite, conditional RewriteBase? - by El Forum - 12-17-2009, 07:23 PM
mod_rewrite, conditional RewriteBase? - by El Forum - 12-18-2009, 05:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB