Jump to content
  • 0

Routes .htaccess


Michael

Question

11 answers to this question

Recommended Posts

  • 0

I was just wondering guys if there's a way to do a .htaccess to block access to a route in .htaccess?

 

yes there is :)

 

Just create a file called .htaccess and put that file on the directory you whant to block with the text inside:

Deny from  all

or you can create a .htaccess and put on your main Blesta folder with something like this

RewriteEngine On
# change client/login/ path for any outher path you want to blobk
RewriteRule ^client/login/$ [F]

Hope that helps :)

Link to comment
Share on other sites

  • 0

yes there is :)

 

Just create a file called .htaccess and put that file on the directory you whant to block with the text inside:

Deny from  all

or you can create a .htaccess and put on your main Blesta folder with something like this

RewriteEngine On
# change client/login/ path for any outher path you want to blobk
RewriteRule ^client/login/$ [F]

Hope that helps :)

 

 

Didn't work mate as I'm trying to see if we can only allow certain IPs.

 

Tried:

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REMOTE_ADDR} ^125\.255\.125\.255
RewriteRule ^admin/login/(.*)$ ./index.php
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^125\.255\.125\.255
# change client/login/ path for any outher path you want to blobk
RewriteRule ^admin/login/$ [F,L]
RewriteCond %{REQUEST_URI} ^admin/login/$
RewriteRule ^(.*)$ index.php [R=301,L]
Link to comment
Share on other sites

  • 0

Not sure exactly what you're trying to do, but I use

# Only let the IP 123.123.123.123 view the site. Redirect everyone else to /my/page.php
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/my/page.php$
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123
RewriteRule $ /my/page.php [R=302,L]
Link to comment
Share on other sites

  • 0

 

Not sure exactly what you're trying to do, but I use

# Only let the IP 123.123.123.123 view the site. Redirect everyone else to /my/page.php
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/my/page.php$
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123
RewriteRule $ /my/page.php [R=302,L]

 

Thanks mate didn't work :D I'm trying to restrict access to the admin routes. So if someone tries to be clever they'd just get sent back to the billing portal and not the admin login page if you get me? :)

Link to comment
Share on other sites

  • 0

 

i use

 

you can use

<Files routes.php>
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Files>

 

Thanks mate but that just allowed me to get on. I think if more people would like to be able to limit the routes for admin I will open a feature request because I believe to get it limited will need edits to the routes.php

Link to comment
Share on other sites

  • 0

Thanks mate didn't work :D I'm trying to restrict access to the admin routes. So if someone tries to be clever they'd just get sent back to the billing portal and not the admin login page if you get me? :)

 

 

Very strange that dosent work for you. We use them without any problems :)

 

Do you have any restriction on using .htaccess and/or Rewrite Engine on Apache?

 

Its better and more secure to restrict in .htaccess then in any outher Blesta Core File because in this way there is no direct access to any Blesta File in that rule.

 

A great sugestion is for exemple make Admin Routes Random in the blesta cron every day and send the new route to staff members by email and/or by any sms gateway :)

Link to comment
Share on other sites

  • 0

Very strange that dosent work for you. We use them without any problems :)

 

Do you have any restriction on using .htaccess and/or Rewrite Engine on Apache?

 

Its better and more secure to restrict in .htaccess then in any outher Blesta Core File because in this way there is no direct access to any Blesta File in that rule.

 

A great sugestion is for exemple make Admin Routes Random in the blesta cron every day and send the new route to staff members by email and/or by any sms gateway :)

 

I don't have any restrictions that I know of mate.

Link to comment
Share on other sites

  • 0

Thanks mate didn't work :D I'm trying to restrict access to the admin routes. So if someone tries to be clever they'd just get sent back to the billing portal and not the admin login page if you get me? :)

Here you go, mate.

RewriteCond %{REMOTE_HOST} !^192\.168\.1\.
RewriteRule ^admin https://myblesta.panel [L]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...