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
0 answers

Restricting redirects using RewriteCond on a drupal multisite

I am working on a drupal multisite, therefore, my redirects get added to the same htaccess. The problem is my RewriteCond are not working correctly. My RewriteRule for example1.com is also working on example2.com which I do not want. These…
Ronnie
  • 113
  • 1
  • 4
0
votes
1 answer

Can hosts file rewrites be realized in Apache conf?

I have a line in /etc/hosts to rewrite something to localhost: 127.0.0.1 foo.bar Can the equivalent be done without modifying the hosts file, somehow with an Apache rewrite or something like that?
user3761308
  • 103
  • 2
0
votes
1 answer

Encoding double quotes in Apache

Tomcat disallows any presence of '"' (double quote) characters in URL, it is treated as invalid character as per RFC 7230. However I have lot of service clients who are still taking to my service with URLs like…
Sriharsha
  • 101
  • 1
0
votes
1 answer

Using Mod_redirect QUERY_STRING to block URLS

I am trying to write rewrite rules to block URLs with some particular pattern. The requests are as follows as seen in Apache log. "GET /mysecure/Docs?cb=20414624755 HTTP/1.1" 200 881107 "-" "Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101…
Zama Ques
  • 523
  • 1
  • 9
  • 24
0
votes
2 answers

Trying to move people to one webpage with apache2 Rewrite

I am currently trying to get people to go to http://a.abc.com (I send them to the https site after getting some X-HTTP-Headers and saving that in a session) I always want them to go to the a.abc.com site and if the http_host isn't a.abc.com I want…
Thomaschaaf
  • 3,092
  • 5
  • 30
  • 24
0
votes
1 answer

Apache return 429 only to bots, for specific urls

i have a Magento website working with Apache2 and every day i get bots crawling urls that i do not want to and i would like to return 429 for specific urls. i have tried this in my htaccess RewriteEngine On RewriteCond…
x86fantini
  • 13
  • 3
0
votes
1 answer

Reverse Proxy to login page

I’m struggling to get my reverse proxy to work as desired… My Apache instance should work as a reverse proxy to a backend application server, like specified in the proxypass/proxyreverse directives below. Desired behaviour is: client requests…
Leeveeo
  • 3
  • 4
0
votes
1 answer

nginx reverse proxy apache url silent rewrite and https rewrite

I have a nginx + apache configuration running. I am VERY VERY new to nginx and I am having quite a time trying to learn it. First I want to do a basic rewrite. As per my understanding, when nginx is used as a reverse proxy - .htaccess from apache…
Bruce
  • 103
  • 1
  • 5
0
votes
1 answer

What am I doing with mod_rewrite?

I am aware of the canonical question and have read it, yet I seem to be unable to find some stuff there. Here are my conditions and rules to drop www and force https: RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1…
Džuris
  • 145
  • 1
  • 9
0
votes
1 answer

htaccess redirect all traffic on specific domain to another domain, exclude folder and filetype

Multiple alias domains pointing to the same cPanel account are sharing the same .htaccess file. I need a domain-specific rule that redirects all traffic from aliasdomain.com to https://www.domain1.com only if: HTTP_HOST is currently aliasdomain.com…
comdex420
  • 3
  • 2
0
votes
1 answer

Redirect problem using .htaccess mod_rewrite only for root

I'm trying to permanently redirect all requests to my root directory to another site. I don't want anything other than the root requests to be redirected. Requests to "http://www.example.com" should to to "http://www.example2.com/blah" I can get…
user25958
0
votes
1 answer

In Apache, is it possible to serve data from one URL while displaying a separate URL in the browser?

I have a multilingual web application that depends on a language code being in the URL. Example: example.com/zh-hans/title The client now wants a new structure: example.com/cn/title The problem is the application was built around using zh-hans.…
user658182
  • 135
  • 7
0
votes
1 answer

ERR_TOO_MANY_REDIRECTS using Virtual Hosts

I'm getting an ERR_TOO_MANY_REDIRECTS when entering my website, using Google Chrome. I'm not using any rewrite module. This is my website configuration: (Literally a Virtual Host) ServerName mcwownetwork.net ServerAlias…
user406214
0
votes
2 answers

HTTP to HTTPS rewrite not working the first time

I all, I have a strange problem with redirection to HTTPS on Debian running Apache. When a user visits http://subdomain.url.nl for the first time, a page not found is reported. When the user visits https instead, it works. Then user closes the…
Mbrouwer88
  • 163
  • 1
  • 3
  • 11
0
votes
2 answers

apache proxy server and rewritecond

Combination of a webserver and a tomcat server. Everything runs under https. The tomcat server is only accessible via a proxy server. I want to rewrite all requests with "my_module" to the tomcat server. (tomcatmodule.war) proxy server:…
Jens H
  • 1
  • 2