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
1 answer

How to set custom connection timeout for all requests to a certain backend?

I am looking for something like: BalancerMember http://www.example.com:8080 timeout=1 But I don't want to specify what urls go to that backend at all --- this is controlled else where --- like RewriteCond on…
Superziyi
  • 123
  • 4
0
votes
1 answer

Apache HTTPD mod_rewrite rule to redirect a specific path to a Tomcat Worker (AJP)

I've an Apache HTTPD server (and it's driving me nuts already). I've configured several tomcat workers. So a https://something.domain/WebApp1/ activates the web-application on the specified tomcat via AJP. However, due to a naming convention change…
OddDev
  • 111
  • 6
0
votes
2 answers

Mod_rewrite rule to redirect from a specific path to another is completely ignored

I need to redirect http://1.2.3.4/foo to http://1.2.3.4/WebFOO. The rule that I've created looks like this in ApacheRoot\conf\httpd.conf: RewriteEngine On RewriteRule ^/?foo /WebFOO [R,L] However, this approach doesn't work even though this rule is…
OddDev
  • 111
  • 6
0
votes
1 answer

Using rewrite engine to route domains to paths on one DocumentRoot

I have two domains: domain1.com domain2.com I have one Apache 2 server, with a document root /svr. I want the following to occur: domain1.com routes to the equivalent of /svr/examplepath/thisisadir/param/domain1 domain2.com routes to the…
user375234
0
votes
1 answer

mod_rewrites in nested .htaccess causing strange 404

I have an apache HTTP server with a directory structure as such: / ---- api/ ---- ---- index.php ---- ---- .htaccess ---- index.php ---- .htaccess /.htaccess: DirectorySlash Off RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d RewriteRule…
Hele
  • 101
  • 2
0
votes
1 answer

htaccess RewriteRule for multiple files or path

Hoping someone better at htaccess RegEx than I is out there! I am trying to replace (well remove) a particular path from a URL, however my rules onle seem to want to remove the first folder, not the entire path. Here's a rule I am testing with,…
Blatant
  • 111
  • 1
  • 7
0
votes
1 answer

Apache Rewrite URL while acting as reverse proxy

I seem to be having trouble with Apache's mod_rewrite to rewrite URL requests while using it with mod_proxy to act as a reverse proxy. In summary, I'm trying to redirect requests to unminified CSS to my minified CSS located in another directory. I…
Felix Jen
  • 403
  • 5
  • 18
0
votes
1 answer

Redirect subpages to parent-directory

I want to redirect all requests for subpages to the directory root. Unfortunately I only get redirect loops. Here is a sample of my .htaccess-file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^parent-directory/.*$…
schuggerleo
  • 45
  • 1
  • 2
  • 8
0
votes
1 answer

Accessing site via multiple virtual hosts with https

I have an apache server that sits in front of a JIRA Service Desk instance running on Windows Server 2012. We have 2 customer portals in JIRA and I need to set up Apache so that each customer portal can be accessed via a different virtual host. Like…
0
votes
1 answer

Is it possible to avoid certificate warnings in Apache for alternate SSL host names?

I have an Apache server serving a single virtual host https://app.example.com. For legacy reasons the site is also known under another name https://myapp.example.com. For users connecting to the legacy name, they get a browser certificate warning…
Aditya K
  • 923
  • 3
  • 13
  • 24
0
votes
1 answer

Rewrite user and password in proxied requests

I need to rewrite the client authentication scheme in requests going through an Apache 2.4 reverse proxy. Specifically, I want to ignore the provided username and password, and force the same username + password for all requests. Is that doable ?
Nicolas Melay
  • 615
  • 5
  • 12
0
votes
1 answer

mod rewrite not working after dist-upgrade debian 7 to 8

I needed to upgrade my Debian OS version on a server, from 7 to 8. So i did : aptitude update aptitude upgrade to have the latest wheezy packages, then change in /etc/apt/source.list (and other source.list.d/ files) the term wheezy to…
Overdose
  • 101
0
votes
4 answers

mod rewrite regex

The plan is to take domain.com/chat2/roomnumber and redirect to domain.com/chat2/index.php?room_id=roomnumber. Here's my code that's NOT workin: RewriteEngine on RewriteRule ^/chat2/([a-z0-9_-]+)/$ /index.php?room_id=$1 [NC,L] …
Benny B
  • 159
  • 2
  • 4
0
votes
1 answer

How to forward page to different file using mod_rewrite

I'm trying to user mod_rewrite to forward user from default index.html to default.php, I've tried using: Redirect 301 /index.html /default.php in /html/.htaccess but it adds default.php repeatedly until it…
0
votes
1 answer

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 subdomain. RewriteEngine On RewriteCond %{HTTP_HOST}…
MaikelVE
  • 3
  • 2