Help with mod-rewrite to display a new url - mod-rewrite

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]

Related

How do we make the cs cart api work after installation?

I installed cs cart on new server and also enabled the API user access. But the api is giving back 404 not found error. Not sure what is needed in here.
Can anyone please help!!
please try yoursite.com/api.php?_d=products (e.g. in browser)
if it works, make sure that .htaccess root file (for apache servers) has lines:
RewriteCond %{REQUEST_URI} ^api/(.*)$ [or]
RewriteCond %{REQUEST_URI} .*/api/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*api/(.*)$ api.php?_d=$1 [L,QSA]
it might mean issue with mod_rewrite which is not configured or configured incorrectly on the server
p.s. if the server is on nginx, analogue configuration is needed
Enable API for an administrator user
Folow documentation
https://docs.cs-cart.com/4.9.x/developer_guide/api/index.html

Rewrite https Apache/Tomcat url

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

mod_rewrite redirects to .html in error

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.

Codeigniter URL Rewrite SSL HTTPS

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

Apache mod-rewrite in httpd.conf not working

I need to make a change to my Apache web server to redirect requests for the home page from iPhone browsers to a different page. I've edited the /etc/httpd/conf/httpd.conf file and added the following:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*iPhone.*
RewriteRule ^/$ /iphone/index.html [L]
After making the change, I restarted httpd, but the redirect doesn't work.
Am I missing something? Do the edits need to be made to a specific location in the httpd.conf file?
Other info: Server is vps hosted by Lunarpages running CentOS 5.5 and Apache 2.2.3.
For me, I use like below
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*iPhone.*
RewriteRule ^[\./]$ <MyDomain>/iphone/index.html [L]

Resources