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

apache mod_rewrite question with multiple parameters to parse

I've been struggling to get the following rewrite working ^/agatedepot/([0-9.]+)/([0-9a-zA-Z._]+)\?doc-id=([0-9a-zA-Z._\-]+) to /agateDepot.php?date=$1&filename=$2&doc-id=$3 I know that mod_rewrite is working. I know that it is reading the…
Chris Hartjes
0
votes
0 answers

Apache RewriteRule, transfer string match into query string parameter

Our website has been redeveloped, and I have been asked to ensure that the previous form of certain URIs are redirected to the new form, so that existing links, bookmarks, etc, don't break. The previous URIs were of the form /people/show/person/123…
0
votes
1 answer

Rewrite rule for wordpress subdomain

I have a Zend Framework php application that sits on www.mysite.com that works fine and uses the standard .htaccess file with the following rules. RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css|html)$ index.php I now want to add a…
Grant Collins
  • 159
  • 2
  • 9
0
votes
1 answer

400 Bad Request Rewriting HTTP to HTTPS not working

I am running an apache 2.4.25 on a Debian-Server. There is a website reachable via: example.de and www.example.de they should be rewriten via configs and .htaccess to: https://example.de https://www.example.de That does not work. This lines…
Zehke
  • 13
  • 4
0
votes
1 answer

How to fix ProxyPass in URL and subfolder?

I made a proxy pass adding to my localhost instance the path /vocab/arch. Here the configuration I used: ProxyPass /vocab/arch http://localhost:3000/ ProxyPassReverse /vocab/arch…
Pelide
  • 101
0
votes
1 answer

Using Apache2 mod_proxy to different server while keeping .htaccess rules somehow working

I am trying to move a part of my website to an external server. I want this part to be accessible through a subdomain, while still being able to apply RewriteRules (doesn't matter whether thats done by .htaccess or Apache2-.conf files, any method is…
0
votes
0 answers

Using mod_rewrite to reverse proxy between https domains

I'm on a shared host, so can only do redirects via htaccess, but the plan is to have multiple subdomains (each with a letsencrypt certificate issued via cPanel) to point to a universal set of php files within a folder of the main domain using a…
0
votes
1 answer

Apache Rewrite RULE

People I have been working for days in this and I,m no able to make it work. I,m trying to do a RewriteRule in my apache server but is not working. if i use a simple url like this it works perfect. RewriteEngine On RewriteRule ^(/.php/m/)…
Cano63
0
votes
1 answer

Rewrite rule in .htaccess that blocks all connections with specific Query String value

I've tried a few variations, but can anyone help me out with a rewrite rule in a .htaccess that would block all connections where a query string value of x=y. /app/index.php?x=y
0
votes
1 answer

Reverse proxy with mod_rewrite

I am trying to achieve this: subdomain.mydomain.com/customerA -> internalserver1/application/ subdomain.mydomain.com/customerB -> internalserver2/application/ This broght me to the login page of the application (on mobile only and with no…
gvnn
  • 3
  • 1
0
votes
2 answers

Nginx: Rewrite sub-directory to different directory

Currently I have a directory that is down a bit in the codebase, I need to move it to a url that I use on the old server that uses Apache. In Apache I have: RewriteRule ^ait/(.*) system/ait/$1 [L,QSA] I'm trying to write it in Nginx but can't seem…
llanato
  • 211
  • 2
  • 4
  • 12
0
votes
2 answers

Apache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcat

I am using apache2 server running on debian which forwards all the http request to tomcat installed on same machine. I have two files under my /etc/apache2/ folder apache2.conf and httpd.conf I modified httpd.conf file to look like following. #…
Ankit Agrawal
0
votes
2 answers

mod_rewrite add and switch directory

How to change the url pattern with mod_rewrite first from domain.de/images/myfile.jpg to domain.de/directory/images/myfile.jpg and then finally to domain.de/images/directory/myfile.jpg My rules so far RewriteCond %{HTTP_HOST}…
Markus
0
votes
1 answer

Question about RewriteRule and HTTP_HOST server variable

In evaluating a rewrite rule that redirects to a specific URL and say the rewrite condition is met, would it be possible to use HTTP_HOST as part of the URL to be redirected to? Example in question: RewriteRule .*\.(jpg|jpe?g|gif|png|bmp)$…
SeancoJr
0
votes
1 answer

htaccess - .htaccess in sub directory not inheriting .htaccess in root directory

i have 2 .htaccess files first in /public_html/ #ErrorDocument 404 https://example.com/en/404.php RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://example.com/$1 [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond…