Jerielle
Jerielle

Reputation: 7520

htaccess page does not redirect properly

I am using opencart in my ecommerce. And I want to setup an htaccess that will redirect to the admin panel.

Here's my current setup for the htaccess:

RedirectMatch 302 .* http://localhost/dev_beta/flaxcms/admin/

I want to redirect

http://localhost/dev_beta/flaxcms

To

http://localhost/dev_beta/flaxcms/admin/

Can you help me about this? Or if Opencart related is there a way so that only the admin panel is accessible and not the store front end?

Ok thats all I hope you can help me. Thanks.

Ok I update my index.php and I think my code for this is kinda dirty but it solves my issue:

$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

if($actual_link == 'http://localhost/dev_beta/flaxcms/') {
    header('Location: http://localhost/dev_beta/flaxcms/admin');
    exit;
}

I don't think that it is a good idea.

Upvotes: 0

Views: 47

Answers (2)

anubhava
anubhava

Reputation: 786081

Create a dev_beta/.htaccess if it doesn't exist and place this rule:

RewriteEngine On

RewriteRule ^flaxcms/?$ /dev_beta/flaxcms/admin/ [L,NC,R=302]

You must clear your browser cache before testing this change.

Upvotes: 1

Gab
Gab

Reputation: 3520

Please try:

RewriteEngine on 
Redirect 302 /dev_beta/flaxcms$ http://localhost/dev_beta/flaxcms/admin/

Upvotes: 1

Related Questions