.htaccess problem

Discussion in 'General' started by bill, Jun 11, 2013.

  1. bill

    bill New Member

    I have a codeigniter project inside the b1 folder in my shared hosting public_html folder:

    mydomain.com/b1/controller/function

    I want to change it to:

    mydomain.com/controller/function

    in the browser bar using a 301 redirect.

    My .htaccess file in my public_html has:

    RewriteEngine on
    RewriteRule ^b1/(.*)$ /$1 [R=301,L,NC]
    RewriteRule ^(.*)$ b1/$1

    EXPLANATION:

    RewriteRule ^b1/(.*)$ /$1 [R=301,L,NC] # THIS IS TO REWRITE ALL REQUESTS FROM THE NAVBAR IN MY PROJECT WHICH HAVE THE FORM mydomain.com/b1/controller/function TO mydomain.com/controller/function. AFTER THIS THE NAVBAR SHOULD SHOW mydomain.com/controller/function ( I ASSUME )

    RewriteRule ^(.*)$ b1/$1 # THIS IS TO TAKE ALL INCOMING REQUESTS AND ADD A b1 IN FRONT SO mydomain.com/controller/function IS REDIRECTED TO mydomain.com/b1/controller/function - BUT INTERNALLY, SO THAT THE BROWSERS ADDRESS BAR STILL SHOWS A 'PRETTIER' mydomain.com/controller/function

    According to http://htaccess.madewithlove.be/, this should work, but I still see:

    mydomain.com/b1/controller/function

    in my address bar.

    Please note that this is a codeigniter project and CI has the following .htaccess file . ( again the project is in my public_html/b1 directory )

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php/$0 [PT,L]

    As far as I can tell mod_rewrite is working because RewriteRule ^(.*)$ b1/$1 works when a match to the rule above it does not occur.

    Could some combination of the 2 .htaccess files be causing the lack of visible rerwrite in the address bar? I would like to debug this and figure out how to achieve the URL format discussed above.

    Thank you,

    Bill
  2. NiteWave

    NiteWave Administrator

    change
    to
    see if works
  3. webizen

    webizen New Member

  4. bill

    bill New Member

    Thank you - Bill

Share This Page