I have working apache connected with tomcat (mod_jk), I have set two virtualhosts:
myexample_8080.conf
myexample_4430.conf
I want to redirect all requests from http to https and on the home page of https://myexample.com redirect to tomcat url https://myexample.com/login
This is my first rule in myexample_8080.conf
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://myexample.com/$1 [R,L]
Everytime I ended up with redirect loop.
Solution
RedirectMatch 301 ^/*$ https://myexample.com/info
Related
I've hosted my Laravel app on DigitalOcean (Ubuntu 20.04 with Apache installed). I need to redirect the www domain to a non-www domain that has SSL enabled (HTTPS). However, when I try to go to www.example.com it returns a laravel 404 error page.
When I try to write the same www.example.com but starting with HTTPS (https://www.example.com) it redirects successfully to non-www. The only problem is when I try to go to www.example.com it shows an error.
Here is my .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.dukabox.com$ [NC]
RewriteRule ^(.*)$ https://dukabox.com/$1 [R=301,L]
Any suggestion will be helpful
I have a Laravel project where I also run APIs for an APP.
After adding rewrite rules in .htaccess file my APIs of an APP stopped working.
#Redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I've just setup an AMP server on OSX 10.9 and have a bizzare problem which is not present on my live hosting server or my old WAMP server.
I want to redirect any URL that doesn't directly map to a file on the server to index.php. I'm using the following .htaccess code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# prevent loop
RewriteCond %{REQUEST_URI} !index\.php
RewriteRule ^(.*)$ /index.php?/$1 [L]
when I try http://example.com/example there is no problem, but when I introduce another slash, for example, http://example.com/example/
I get the a 404 error The requested URL /example.html/ was not found on this server.
Server version: Apache/2.2.26 (Unix)
Looks like your problem is related to enabling of MultiViews here. Turn it off by using this line on top of your .htaccess:
Options -MultiViews
Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php.
Inside the LAN, we are good to go… folks access our intranet using http:// intranet All links and URLs work just fine and dandy (I removed index.php from links using URL Rewriting).
We are required to give access to the Intranet to certain outside folks.. we are accomplishing this using FTMG, the same way in which Outlook Web Access works.
Now, calls to https:// intranet.domain.org work, but links within the site do not work… for example:
https:// intranet.domain.org works
https:// intranet works
https:// intranet.domain.org/homepage FAILS
https:// intranet.domain.org/index.php/homepage works
https:// intranet/index.php/homepage works
(Disregard space after https://, I received errors for invalid links)
Taking away the 's' from https, and the entire site functions properly.
The dilemma should be clear… implementing the URL Rewriting is not work with https…
How do I make it work?
Note:
my config file =
$config['base_url'] = '';
my .htaccess file =
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Perhaps this will be of some help HTTP/HTTPS, without index.php, using htaccess
hi all
i have my app configured with mod ajp to be as follows:
http://www.myapp.com/myapp
so when i request a page like mypage, the url will be
http://www.myapp.com/myapp/mypage
and i want when the user requests the page
the url is displayed as:
http://www.myapp.com/mypage
instead of
http://www.myapp.com/myapp/mypage
any ideas how to do so ?
problem solved after installing a fresh copy of tomcat
Try this rule:
RewriteRule !^/myapp/ /myapp%{REQUEST_URI} [L]
And to redirect requests of the “wrong” path:
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /myapp/
RewriteRule ^/myapp/(.*) /$1 [L,R=301]