First sorry for my bad English.
So I have an Openhab system on my raspberry PI with Apache.
I have A basic authentication with two groups Admin and Users and I want to redirect Users the open the Landing page to redirect after Loggin with the Basic auth to the UI page. The problem is I can't use a PHP script.
So I tried to redirect the Users with the .htaccess
.htaccess:
<Location />
RewriteEngine ON
RewriteCond %{REMOTE_USER} =Elias
RewriteRule ^start/index /basicui/app
</Location>
But so it doesn't work and I haven't found anything that I help with this problem
I got the Solution
RewriteCond %{REQUEST_URI} ^\/start\/index$
RewriteCond %{REMOTE_USER} =Username
RewriteRule .* http://openhab.clubdrei.com/basicui/app [R=302,L]
RewriteCond %{REMOTE_USER} =Username
RewriteRule .* http://openhab.clubdrei.com/basicui/app [R=302,L]
Related
I had the following code in my htaccess:
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/
The main idea was to remove the "www" from the URL because it was giving problems with Facebook apps, but now the domain has changed, so I updated the htaccess, but it keeps redirecting to that old domain, I know that some browsers keep as cache the redirects, so, is there a way to tell the browser to grab this new redirect condition?
Thanks in advance.
Clear your browser's cache and try this :
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [NC,R=301,L]
From our client's site (http://www.cfm33.com/) we need to redirect all mobile devices to the mobile site (http://m.cfm33.com/), and this works.
But we really need an exception for the reservation page, so that users even on mobile get redirected to this reservation page of the desktop site.
Here's what's in the .htaccess :
## Mobile redirect
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone|Android|iPad|iPod|Blackberry
RewriteCond %{REQUEST_URI} !(\.jpg|\.jpeg|\.png|\.gif|\.svg)$ [NC]
RewriteCond %{REQUEST_URI} !reservation-formation.html [NC]
RewriteRule .* http://m.cfm33.com/ [R]
## End mobile redirect
Any idea why the exception does not work ? We've been trying for a few hours and still no clue...
Any idea ? Could this have something to do with some custom routing on the desktop site ?
Thanks
David
Try this rule:
## Mobile redirect
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone|Android|iPad|iPod|Blackberry
RewriteCond %{THE_REQUEST} !/reservation-formation\.html [NC]
RewriteRule !\.(jpe?g|png|gif|svg)$ http://m.cfm33.com/ [R]
## End mobile redirect
Replaced REQUEST_URI by THE_REQUEST as other rules might be affecting REQUEST_URI whereas THE_REQUEST remains unchanged.
Hello i'm stuck in the following situation
One of our developers is outside for the moment and i have never used cakePHP.
I have a site under certain domain
http://example.com
in his .htaccess of the project he has this
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
But i would like that when the user enters straight to http://example.com they get redirected to another page or folder in the root.
The site is hosted in godaddy but if i try to do a redirect using their panel it gets ommited because of the one within the project, i just want to send the user to an "under construction page" while leaving my customer with the possibility of checking his page, but not to the general audience.
You can use:
RewriteEngine on
RewriteBase /
RewriteRule ^/?$ page-under-construction [L,R=302]
RewriteRule ^((?!page-under-construction).+)$ app/webroot/$1 [L,NC]
I got wordpress installed in /WP. So i browsed the web to find an example of a htaccess that can redirect the user from domain.se to domain.se/wp. So if anyone just types in the domain name then they will be redirected to the /wp folder.
This was the one i found and it works.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ http://domain.se/wp/$1 [R,L]
Question is, is it ok like this or is this a bad solution?
I think your code should be the following :
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/wp
RewriteRule ^(.*)$ http://domain.se/wp/$1 [R,L]
The following .htaccess file does not work:
SSLrequireSSL
RewriteEngine on
RewriteCond %{HTTP_HOST} !^secure\.neuralfutures\.com [NC]
RewriteRule (.*) - [F]
I'm trying to prevent access to anything but "https://secure.neuralfutures.com/docs/", i.e. "https://www.neuralfutures.com/docs/" will fail.
I also seem to be running into caching issues: if I upload the new .htaccess with CuteFTP, then do a file refresh in FireFox, it doesn't seem to have any effect on the output at all. I can tell this because if I comment out SSLrequireSSL, it still disallows a http:// request.
why dont you try this
SSLrequireSSL
RewriteEngine on
RewriteCond %{HTTP_HOST} !^secure\.neuralfutures\.com [NC]
RewriteRule (.*) https://secure.neuralfutures.com%{REQUEST_URI} [R=301,NC,L]
Abt caching - May be your web hosting provider has some caching in place, but not very sure abt this.