URL rewriting module for Apache web servers

learn more… | top users | synonyms (1)

3
votes
2answers
327 views

Using CDN like Cloudflare with mod_rewrite to save bandwidth

I know CDNs like Cloudflare save bandwidth by caching static files as images, JS, and CSS files. I have a script that generates images on the fly and its location looks something like this: http://...
2
votes
1answer
3k views

Force SSL for every URL except one path using .htaccess

I'm trying to enforce SSL for every URL except one with the first segment /preview. http://test.example.com/preview/blah/blah should be ignored by the rule; every other URL should be forced to use ...
2
votes
1answer
1k views

Obscuring tomcat context path in URL

I've setup an Apache reverse proxy to Tomcat that is working, in that I can load my url and get connection to the Tomcat backend. What I'm attempting to do now is rewrite the URL that a user sees in ...
0
votes
1answer
20 views

Mod_rewrite: Redirect to url in query string

Apache server receives request in following format http://192.168.110.65/?http%3A%2F%2Fdev.virtualearth.net How do I have Apache generate a redirect to the query string using mod_rewrite http%3A%...
0
votes
1answer
31 views

Can i redirect only my mainpage to www

When i past this code, it redirects my whole website. But when i want to go to ticket.mysite.com it gives me the 404 because it redirects me to www.ticket.mysite.com but i don't want this with a ...
1
vote
4answers
17k views

Why is https not working?

I am trying to redirect just the root of my site to https. Although the rewrite happens, https does not yield anything. The browser says. connecting to thinkingmonkey.me... and stagnates. ...
1
vote
1answer
20 views

add trailing slash after removing .html extention

My website is non www ,it has wordpress in subdirectory and some static webpages in the root and other subdirectory i want to remove .html extention from the webpages in the root and the others ...
1
vote
1answer
25 views

Apache ModRewrite strip part from request_uri in rewriteCondition

so basically I have a link in my html domain.com/app/css/build/app-23471942834.css however on the server the file actually lives in /fs/current/public/css/build/app-23471942834.css. Is there a way to ...
0
votes
0answers
11 views

mod_rewrite enabled but does not working (with letsencrypt)

I know this has been asked a dozen times, but I searched in all the similarly named threats for a solution for hours now. As I did not found one, I will ask again. I have mod_rewrite enabled, but it ...
1
vote
1answer
25 views

How to send all HTTP error codes dynamically to one PHP file when access to all other files is denied?

I'm having the following situation, I'm developing an API. I rewrite all traffic to one PHP script named: route.php, using mod_rewrite like: 1: RewriteEngine On 2: RewriteCond %{REQUEST_FILENAME} -f [...
0
votes
0answers
13 views

Apache rewrite_mod in <Directory> context to override .htaccess

So what I need is to throw 403 to specific paths on my webserver, I'm on Server version: Apache/2.4.20 (Ubuntu 14.04) The paths are localhost/folder/admin and localhost/folder/superadmin for example ...
0
votes
1answer
8 views

Apache mod_rewrite. Able to “failover” when files do not exist?

I'm trying to configure mod_rewrite to attempt to load/serve files in a specific order. I think the easiest way to describe what I'm trying to achieve is with an example. Let's say in my document ...
1
vote
0answers
15 views

.htaccess RewriteRule for directory based with two parameters [duplicate]

I need to redirect my webpage in the likes of /dir/script.php?a=123&b=foobar to /123/foobar I've found many answers for questions like this in this site, but none of them work for my problem....
0
votes
0answers
20 views

Ngnix Rewrite Setup Along with Reverse Proxy (have some upstreamed servers)

I need to setup one URL rewrite rule in nginx, also I am having the same nginx server have 8 to 10 unstreamed servers (reverse proxy), which is running on 8080 port. I want to setup that rewrite rule ...
0
votes
1answer
36 views

apache2 rewrite configuration not working

I have a file www.example.org.conf that I want to redirect http to https. The problem is the file doesn't exactly work right. <VirtualHost *:80> ServerName example.org ...
1
vote
3answers
1k views

Empty rewrite.log on Windows, RewriteLogLevel is in httpd.conf

I am using mod_rewrite on Apache 2.2, Windows 7, and it is working ... except I don't see any logging information. I added these lines to the end of my httpd.conf: RewriteLog "c:\wamp\logs\rewrite....
2
votes
1answer
1k views

mod_rewrite exact hostname match with multiple conditions

I have a set of requirements for mod_rewrite that is breaking my head. Any hints / pointers would be appreciated: domains: www.domain-europe.com www.domain.com requests for www.domain-europe.com ...
0
votes
2answers
1k views

Redirect page/subfolder to new domain url without changing url in browser

I have been looking for an answer this without any luck (searched everywhere) Basically, I want to rewrite a page (subfolder) to a new domain without changing the url. I've tried with no luck: ...
2
votes
0answers
14 views

RewriteRule passes request to index.php

I have these two sets of rules in .htaccess: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^ index.php [L] RewriteCond ...
3
votes
1answer
1k views

Apache redirecting https://host:port/folder to http://host:port/folder/

I have a apache server using two SSL domains (no SNI support) in different ports, kinda like this: https://host1.tld:443 (default) https://host2.tld:444 (non-standard) I have a Rewrite rule to ...
1
vote
1answer
1k views

Apache ProxyPass/RewriteRule with p flag: Return no content when response has multi-part content type i.e.images

This is a continuation of a previous question which has been implemented with a little change. Following is the structure I am going to talk about. My goal is to create the Tunnel/Proxy. ...
0
votes
1answer
29 views

Apache htaccess redirect http/www to https/non-www [duplicate]

To redirect from - http://www.domain.com - http://domain.com - https://www.domain.com to https://domain.com im using the following (apache)htaccess: <IfModule mod_rewrite.c> ...
0
votes
0answers
53 views

to set RequestHeader in apache httpd server is not working

I have a requirement, where I need to set the RequestHeader with a value retrieved from the querystring of the URI. Approach adopted is to write the RewriteCond and ReWriteRule where the condition ...
0
votes
5answers
5k views

Trying to redirect a url to another page by IP range

I'm having a bit of a trouble here. I have this several rewrite rules which I think does not work. My main purpose is to restrict pages and allow only specific IP or network block. RewriteEngine On ...
1
vote
2answers
460 views

apache httpd Redirecting URL based upon Server Name

We have a Jira and a Confluence system at my work. Both are running on the same servers. The actual URL to access Jira and Confluence are: http://foauslxapp05:8080/jira http;//foauslxapp05:8090/...
0
votes
2answers
11k views

Removing php extension with .htaccess does not work

I use the following code on my site elixnews.com to remove php extension from: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
1
vote
2answers
32 views

Rewrite problems with custom website and wordpress

I am managing a website tasteporto.com that is simple php/mysql with a blog part in wordpress. On the main website I have the following apache rewrite rules RewriteEngine On RewriteBase / # no-www ...
0
votes
0answers
11 views

OpenCart SEO isn't functioning even with SEO Button Enabled and htaccess configured

I have opencart installed with ubuntu 14.04, my apache config file is: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName example.com ServerAlias www.example....
2
votes
1answer
1k views

How to block all incoming proxy visits except from one specific I.P?

I have a page that is prone to attacks, so, in order to reduce the anonymous attacks, I use this code in my .htaccess which I found online : # BLOCK PROXY VISITS <IfModule mod_rewrite.c> ...
0
votes
1answer
28 views

Is there a way of writing cleaner rewrite rules if you've a large number of redirects to implement

I recentley completed a project whereby I moved a pretty large website to a nice clean smaller website. What this meant was I had to account for a large number of pages that had been indexed by search ...
2
votes
1answer
73 views

Can I use Apache variables with mod_alias's `Redirect`, instead of using mod_rewrite?

The Apache HTTP Server's mod_alias provides the Redirect directive which is great for simple redirects, like the following: # Redirect login to https Redirect permanent /login https://www.example.org/...
-1
votes
1answer
37 views

Redirect old domain to new domain with full path

I've very little knowledge in this area - hence the question... I'm looking to do the following: I currently have a server with a number of websites listed in sites-available and sites-enabled. There ...
0
votes
3answers
254 views

Check if file exists in subdirectory and otherwise redirect everything to main controller

What I'd like to do with mod_rewrite in a .htaccess file under Apache is the following: If a request for any file or path, e.g. foo.txt or foo/bar, is received, check if such file exists in the ...
2
votes
0answers
75 views

Apache mod_rewrite rule to pass specific REQUEST_URI to specific html files

I have a very basic html presentation which I want to use Apache mod_rewrite to handle the URLs. home.html is just an intro page but I want this to be called when there is no REQUEST_URI ...
1
vote
0answers
22 views

Apache 2.4 mod_rewrite rule applying redirect to non-redirect rule (only [L] flag)

So I'm having this crazy-making issue happen on apache 2.4/CentOS7 with a web app. I want to redirect all non-secure URLS on the app domain to secure versions, EXCEPT for one uri (a webhook endpoint ...
0
votes
0answers
15 views

Move 2 subdomains without breaking links to themselves

Assume www.example.com contains two sub-domains, each with a different site, such that www.example.com/sub1 and www.example.com/sub2 are not related to each other. I want to move/rename sub1, but I ...
1
vote
1answer
102 views

How to redirect two domains, with/without https, to one https site?

I'd like to do the following: using Apache, redirect all of the following URLs: http://example.com http://www.example.com http://beta.example.com https://example.com https://www.example.com https://...
0
votes
2answers
3k views

Apache rewrite rule and keep the url unchanged?

I have this rewrite rule RewriteRule ^ar$ /index2.html but i need to keep the url in the address bar unchanged after the redirect. ie. if the user typed http://mydomain.com/ar i need to ...
0
votes
3answers
174 views

mod-rewrite sub-domains

I've got a pretty unique issue (at least i've never seen it before). I have an account on a shared host, where I host multiple domains. So, domain A (the main acct) is the root folder on the wwwroot ...
1
vote
1answer
32 views

Remove double slash in gitlab address [closed]

I set up gitlab on my personal server and used this answer and this answer (along with some input from this to make it work with my apache installation. Everything works fine, when I go to gitlab....
1
vote
0answers
14 views

Apache mod_rewrite Take @2x out of image request uri

For an acute server crash problem, I'm trying to match any request for @2x retina style images, and rewrite it to the non-@2x equivalent. First I want to check this is such a request: # NOTES: ...
0
votes
0answers
10 views

htaccess on subdomain & query string

I have the following htaccess RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^(.*).domain\.com RewriteRule ^(.*)$ index-merchant.php?id=%1 [NC,QSA] It can capture $_GET['...
0
votes
0answers
57 views

Tomcat/apache2 application - virtual host issue. Welcome.action URL not found. Possible mod_rewrite issue

Im having some issues setting up a tomcat application to work with apache2. My KonaKart tomcat application is running on port 8783. And I'm trying to access it publicly on port 443. I created the ...
0
votes
2answers
53 views

Apache rewrite all URLs to lowercase if contains at least one uppercase

I have been trying to get Apache to rewrite all URL's that contain an uppercase character anywhere in it to be lowercase. All the solutions I have found do not work in my case for some reason. I am ...
2
votes
2answers
59 views

How to keep one page of a site secure using mod_rewrite

I'd like redirect access to a url from http to https for only a couple of pages on my website. I know how to do it for a whole site using the rewrite in apache virtual hosts: RewriteEngine On ...
2
votes
3answers
1k views

Server remembering old rewrite rules, even when I remove htaccess

I have set up a development server with Ubuntu and LAMP, but for some reason the .htaccess is acting strange... There is a site on there with a set of rules, when I comment them out they still work, ...
0
votes
0answers
6 views

How to redirect all specific character strings? [duplicate]

I want to redirect all character strings to the index page using the RewriteCond Directive. A few examples to illustrate my intention www.example.com/character-string/ should redirect to www....
1
vote
0answers
7 views

Limit access for subdir url

I would like to limit access for this url, http://example.com/dir/login however it doesn't work. The .htaccess lives inside the subdir. The conditions and rule itself works without the REMOTE_ADDR ...
0
votes
2answers
50 views

How to disable the automatic redirection in WordPress-htaccess-file

WordPress has a function in its htaccess-file which performs an automatic redirection if the filenames match with an existing source. For example if you type in http://rechnen-in-der-wolke.net/...
0
votes
1answer
56 views

RewriteRule changes URL only when it doesn't end with slash?

This simple rule in .htaccess handles languages at my website: RewriteRule "^(de|it|es|fr|en-us)(?:|/(.*))$" "$2?lang=$1" [NC,QSA] It works fine unless I miss slash at the end of URL. Than it ...