Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] .htaccess hide frontend_index.php and backend_index.php
#1

[eluser]alx_benjamin[/eluser]
Hello,

I need some help writing .htaccess file to hide
frontend_index.php
and
backend_index.php

I ve setup CI for use with multiple applications.
Here s the directory structure:

-CodeIgniter_1.6.3
-frontend
-backend
-WEBROOT
--frontend_index.php
--backend_index.php

I ve tried .htaccess to hide only front_end.php and it works.
But I don t know how to configure .htaccess to hide both files.

Here s my .htaccess:

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ frontend_index.php/$1 [L]

Thank you.

Alex
#2

[eluser]narkaT[/eluser]
you'll have to chose an "directory" that you forward to your backedn_index.php:

Code:
RewriteCond %{REQUEST_URI} ^/backend [NC]
RewriteRule ^(.*)$ backend_index.php/$1 [L]

to get rid of the "backend" in the routering process (CI would search for an
controller namend "backend") you could create a route:
Code:
$route['backend(.*)'] = "$1";


so when the uri '/backend/controller/method' is requestst your ht access would redirect
that request to your backend_index.php where CI would route that URI to 'controller/method' Smile
#3

[eluser]alx_benjamin[/eluser]
Thanks buddy, worked like charm
#4

[eluser]narkaT[/eluser]
nice to hear Wink
#5

[eluser]Joel Wallis[/eluser]
Very smart solution! Thanks for sharing! =)
#6

[eluser]Haqqi[/eluser]
[quote author="narkaT" date="1224262739"]you'll have to chose an "directory" that you forward to your backedn_index.php:

Code:
RewriteCond %{REQUEST_URI} ^/backend [NC]
RewriteRule ^(.*)$ backend_index.php/$1 [L]

to get rid of the "backend" in the routering process (CI would search for an
controller namend "backend") you could create a route:
Code:
$route['backend(.*)'] = "$1";


so when the uri '/backend/controller/method' is requestst your ht access would redirect
that request to your backend_index.php where CI would route that URI to 'controller/method' Smile[/quote]

it won't work with me. I have a same problem, but the difference is my main web is under subfolder.

here is my structure:
-ci_core (the core of CI)
-mainweb (folder to be associated with index.php
-mimicart (folder to be associated with indexmimi.php
-index.php
-indexcart.php
-.htaccess

all of those files and folder are located in http://localhost/mimi-creative

here is my htaccess file:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #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} ^mainweb.*
    RewriteRule ^(.*)$ /mimi-creative/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 ^(.*)$ /mimi-creative/index.php?/$1 [L]

    #Mod rewrite for mimi cart
    RewriteCond %{REQUEST_URI} ^mimicart.*
    RewriteRule ^(.*)$ /mimi-creative/indexcart.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 /mimi-creative/index.php
</IfModule>

Please give me some direction...




Theme © iAndrew 2016 - Forum software by © MyBB