Modifying .htaccess and RewriteBase

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waqasahmed996
    New Member
    • Jun 2008
    • 160

    Modifying .htaccess and RewriteBase

    Hi everyone

    I need a little help with a .htaccess file and RewriteBase.

    The app I'm trying to run is a php CodeIgnitor app, and the .htaccess looks like it has been coded so that the app will only have correct URLs if the index.php is kept at the server document root. The app author runs all his apps on virtual hosts, but I keep all my apps in subdirectories in my /Sites/ directory (running off the default OS X Apache 1.3). So I need to adjust my app .htaccess so that it takes the subdirectory in to account.

    This is how it looks at the moment (when the app expects to be running straight from the document root, i.e. /Sites/index.php);
    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    The app is located at /Sites/stampychan/index.php, so I was thinking I needed something like this (although, it doesn't seem to work);
    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /stampychan
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
  • xNephilimx
    Recognized Expert New Member
    • Jun 2007
    • 213

    #2
    Hi waqasahmed996.
    If I understand correctly, you run you CI (CodeIgniter) app in http://stampychan (or something to that effect), right? If that's correct, it's like a virtual host.
    Is /Sites/stampychan the web accessible folder? or you have a public_html or htdocs folder inside? if so, put the app inside that one, and keep the .htaccess file in the same level as the CI app index.php file, and leave RewriteBase just with the /

    That should work, but if it doesn't please, provide more specs so I can understand your problem correctly.

    Comment

    • waqasahmed996
      New Member
      • Jun 2008
      • 160

      #3
      hi xNephilimx ,
      Thanks for your kind reply. Yes i exactly facing that problem. i will try your mentioned solution also but currently i solved the problem by using subdomain.
      like


      any person who want to know further about subdomain then following link is very useful for him

      Intro Developing websites on localhost may sometimes need making of sub domains. Installing and running another server for this purpose is u...

      Comment

      • xNephilimx
        Recognized Expert New Member
        • Jun 2007
        • 213

        #4
        Nice move! I always recommend the use of virtual hosts, so you can have everything in their own space, it's more organized, and this way you don't have to try to fix the .htaccess

        Kind regards

        Comment

        Working...