Questions tagged [mod-rewrite]

mod_rewrite is an Apache module that allows for server-side manipulation of requested URLs.

For an introduction and examples of using mod_rewrite, read over the comprehensive article,
"Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask"

2224 questions
0
votes
3 answers

Redirect to client subfolder on apache

I'm hosting a few small client pages within my web application. Basically, they all are instances of the web application I wrote, for different clients. I'm deploying with capistrano, and so each time I deploy a new release, it actually gets…
jwir3
  • 155
  • 1
  • 2
  • 10
0
votes
1 answer

Apache RewriteRule with Proxy and Changing Content-Type

We are currently using mod_proxy to proxy to proxy to the correct destination with the following line: ProxyPass /my-path balancer://server/path/to/real/thing However, a third party is sending us requests with the wrong content type. Getting them…
Xetius
  • 396
  • 4
  • 9
0
votes
1 answer

mod_rewrite to replace all dots with underscores after path

I've been through all tagged questions here and on SO, but my problem is different because of either/both needing to replace "." with "_" comes after a particular path and I'm running through a proxypass. I am trying to…
TryTryAgain
  • 1,152
  • 5
  • 22
  • 41
0
votes
1 answer

Apache2 and proxy_balancer BalanceMember

I've got this Apache2 site configuration, allowing me to "run Apache as a proxy" of the localhost:8080 service. ServerName foo.mydomain.com RedirectPermanent / https://foo.mydomain.com/
auino
  • 143
  • 7
0
votes
1 answer

Implement apache equivalent mod_rewrite functionality in lighttpd

Here's the mod_rewrite .htaccess file which is meant to work on Apache Servers for my web-app RewriteEngine On RewriteBase /cs200/tokens/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php…
Titanoboa
  • 101
  • 2
0
votes
0 answers

RewriteCond fails on existing file

So, my .htaccess file starts with: Options -MultiViews RewriteEngine on RewriteBase / And I tried: RewriteCond %{REQUEST_FILENAME} -f or RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f or RewriteCond %{REQUEST_URI} -f But RewriteRule never…
user64675
  • 91
  • 1
  • 2
  • 8
0
votes
1 answer

How to read specific character out of request header in apache http.config

We are trying to read specific character out of http request header to determine the type of URL it needs to be forwarded it. E.g., Http header - HTTP_ACCEPT=version.ver1+xml In Httpd.config, we need requested version value (as in above case its -…
Sujit
  • 1
  • 2
0
votes
1 answer

Apache: Extracts parts of variables from rewrite rules in headers

I have a rewrite map associating pictures hash to the real path (to be kept secret) of the picture. With a single rewrite rule I can give back the picture with the hash as the url, that's fine. However this is the path that I would like to keep…
0
votes
1 answer

Without using mod_rewrite, what is the best way to redirect all subdomains to https?

I am currently using mod_rewrite to redirect all subdomains to https, but multiple sources have suggested that Using mod_rewrite to do this isn't the recommended behavior. See RedirectSSL The apache docs suggest Redirect and RedirectMatch: A…
MaxPRafferty
  • 303
  • 2
  • 6
0
votes
0 answers

Fix ERR_TOO_MANY_REDIRECTS after adding trailing slash in URL

I have a Magento website hosted in a managed server where we need to use two .htaccess files, the first one is needed to redirect all request to a subfolder /current/src/ and is placed directly in public_html which is the web root RewriteEngine…
Proxium
  • 111
  • 5
0
votes
2 answers

apache 2.2 mod_rewrite redirect some urls to https and force http for others

I have my page at a shared host. In general the site is reachable using http and https. The page serves ads and most of the ads are not available using https therefore I only want the admin parts to be reachable via https. What I want…
stefa
  • 1
  • 1
0
votes
0 answers

Backreferencing a cookie value in rewriterule

I'm trying to backreference a cookie's value in a RewriteRule : # Trace rewrite rules log LogLevel alert rewrite:trace4 # Rewriting the URL, in the cookie's condition i've tried en alone, and en|fl|nl without sucess RewriteCond %{REQUEST_URI}…
Ismail H
  • 107
  • 7
0
votes
0 answers

How to block referral source on apache with special characters?

I've been getting referral spam on my site. I've tried several options to block it, but it still hits it. I think it has to do with being special characters on the referral? This is the referral source: с.новым.годом.рф This is my vhost…
smorhaim
  • 229
  • 1
  • 7
0
votes
1 answer

Apache redirect - let's encrypt SSL certificate redirecting to naked domain rather than www

I recently set up a new website running off Wordpress which is working nicely. Since I wanted to have an SSL certificate for the website I thought I'd use Let's Encrypt since I've been hearing a lot of good things about it. Well I have to agree it…
Cromulent
  • 316
  • 1
  • 2
  • 18
0
votes
1 answer

Redirecting all requests on one domain to https non-www

I have an ISPConfig 3 site running on one domain. I have multiple vhost files for the different applications I run through Apache. I want to enable https://example.com/%QUERY_STRING% on every request that come through Apache with that domain. Right…
ashraj98
  • 163
  • 2
  • 8