Questions tagged [rewrite]
URL Rewriting maps an incoming URL to a modified URL, so that the request is processes as if the original request was made to the modified URL. This is often used to provide more search engine friendly URLs.
2,128
questions
0
votes
1
answer
27
views
Redirect/Rewrite requests from IIS7 to Nginx (2 different servers)
Context:
We've a Microsoft Server 2019 with IIS7 hosted on an internal network (publicly accessible) with a dedicated IP 1.2.3.4 where the root subdomain dept.company.com is linked (assigned by my ...
0
votes
0
answers
31
views
IIS subapplications of a main site have problems fetching static files accesssed programmatically by Web application root operator (~)
I have a Windows Server in a local LAN having different asp.net core applications written in blazor and Razor.
The Windows Server has a static IP 192.168.1.5.
I want to access the sites:
main (192....
0
votes
0
answers
21
views
In nginX, how to rewrite files without extension?
I have lots of image files without an extension (no .png, .jpg, .etc) in the Wordpress uploads folder (/wp-content/uploads/2024/). These do appear in articles and are used, but due to the missing ...
0
votes
0
answers
23
views
Lighttpd rewrite rules for WordPress Multisite in a subdirectory
I need a Lighttpd rewrite rule for a WordPress Multisite in a subdirectory for my local install.
# Rewrite
url.rewrite-final = (
"^/([_0-9a-zA-Z-]+/)?(wp-json.*)" => "/index....
0
votes
0
answers
53
views
How to host applications on separate paths of a subdomain?
I have two application "foo" and "bar" running on ports 4560 and 4570 respectively.
Both of them have paths that look like /api/v1/hello and /api/v1/world.
I'm trying to access ...
0
votes
0
answers
65
views
Apache custom rewrite rule, using code
I would like to have Apache handle some custom URL rewrite code that I have. This code rewrites the following urls:
https://www.example.com/request?data=SOMEDATABLOB
into urls pointing to PHP pages. ...
0
votes
1
answer
37
views
HaProxy custom ports
I need to load balancing one of our customers application portal. The flow works as follow:
The enduser reach the portal through the URL example.net:3000/login page;
The enduser will choose one of ...
0
votes
1
answer
50
views
IIS Rewrite is not matching plus sign in URL Path
I have the below IIS rewrite rule,
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions ...
0
votes
0
answers
154
views
How to deploy Gophish in a running IIS Server
I am a beginner in Windows Server management. Currently, i have a VPS which already has a website running in IIS 10. Also have a domain which already point out to the Server's IP Address for that ...
0
votes
1
answer
123
views
nginx rewrite should be a loop
Is chatGPT bullsh!ttn me, or am I missing something obvious?
This is my question:
I have an nginx location block like this:
location / {
location ~ \.html {
# First send it back to ...
0
votes
1
answer
71
views
Need equivalent .htaccess rule in apache just like nginx so I can get everything in URL
I have a VPS where I am using nginx and uses following to do URL rewriting.
location / {
try_files $uri $uri/ /index.php?$args;
}
Then I simply go to index.php and use the following code to get ...
0
votes
1
answer
196
views
HOW Check Url Parametr and Redirect with Nginx rewrite
I want to check if a parameter is present in a url in nginx and then rewrite.
How can i do that?
For e.g if url is http://website.com/search/node/item123/loc=33 then redirect to http://website.com/...
0
votes
0
answers
37
views
reverse proxy shall act as a cache and provide a website under a different domain
Assume a webserver providing a language version of a website accessable under the URL
http://www.website-a.com/zh-hans/some-otherstuff/index.php
I want to setup a reverse proxy for one language ...
1
vote
1
answer
72
views
Apache VHost Redirect /dir/ to subdomain
I had applications running on the following variable links:
www.example.com/topics/vardir/show
www.example.com/education/topics/vardir/vardir/show
www.example.com/literacy/topics/vardir/show
www....
1
vote
3
answers
148
views
apache2 rewrite is working, but doesn´t keep URL
I was looking around google for some days now and can´t get it to work.
With apache rewrite: domain.com > test.com/test (but keep the URL domain.com in browser)
The whole SSL Config:
<...
2
votes
1
answer
685
views
How Check Url Parametr and Redirect with Nginx
I want to check if a parameter is present in a url in nginx and then rewrite.How can i do that?
For e.g if url is http://website.com/Cat-8/ID-1/Ads-4-3?page=1 then redirect user to http://website.com/...
1
vote
1
answer
179
views
how redirect to specific after word with nginx rewrite
I'm sure this has been asked before, but I can't find a solution that works.
A website has switched CMS services, and i want after ?page= page redirect to main content ! on nginx and with rewrite
I ...
0
votes
1
answer
80
views
Apache rewrite any uri to index.html but existing files
My front-end project is based on 1 file: frontend/index.html
It means that every request like /contact, /about, etc should be responded by index.html file.
I was thought I can use these lines in my ...
0
votes
0
answers
497
views
Kubernetes Gateway API - Using HTTPRoute rules to rewrite URI paths
My goal is to have a single Gateway that can be used to host multiple applications at different paths. The URLRewrite filter exists, however, when it does not seem to be working as expected.
Using ...
1
vote
1
answer
134
views
How to remove amp word from center of url
I removed Amp Module from our site and I need to remove amp word from center of all of urls.
Using Nginx Web server
for example :
mysite.com/shirt/nike?amp=1&product_list_dir=asc&...
1
vote
2
answers
640
views
How to Redirect to specific Login page based on host-name in IIS using URL Rewrite?
I have an IIS website that is mapped (binding) to two separate sub-domains. Let's say x1.domain.com and x2.domain.com
How do I create a rule in URL Rewrite so that I can redirect the user to a ...
0
votes
0
answers
68
views
Rewrite files up a directory and remove file extension
I need to rewrite files up a directory and remove the file extension
I have something like
https://example.com/dir/file.svg
and I want to rewrite the URL to
https://example.com/file
Here's my ...
0
votes
0
answers
121
views
IIS 10 hidden segments go to 404 page instead of 400 which I am setting in URL Rewrite rule
I have a URL Rewrite rule to prevent accessing the site from any URL except a defined list. The rule returns 400 Bad Request if the URL is not in the list.
<rule name="No unknown hosts&...
1
vote
1
answer
138
views
Target app assets not loaded with nginx proxy_pass
I have a basic nginx proxy running on http://127.0.0.1:8080.
This is the nginx.conf:
events {}
http {
server {
listen 8080;
server_name 127.0.0.1;
rewrite_log on;
...
0
votes
0
answers
73
views
Mask Url from path to subdomain using NGINX
I want to achieve url rewrite as such:
https://documentation.domain.com/login to https://app.domain.com/login
https://api.domain.com/login to https://app.domain.com/login
, any sudomain with url {...
0
votes
0
answers
140
views
NGINX Rewrite path to subdomain with cloudflare results in Too many redirects
I want to achieve url rewrite as such:
https://documentation.domain.com/login to https://app.domain.com/login
https://api.domain.com/login to https://app.domain.com/login
, any sudomain with url {...
2
votes
1
answer
322
views
Rewrite Apache Condition not preventing rewrite from getting applied
I'm trying to only allow incoming requests to /multi if the Content-Type request header starts with multipart/form-data, while requests to other POST, PUT, or DELETE endpoints must always have the ...
0
votes
2
answers
541
views
getting error Content Encoding Error (ERR_CONTENT_DECODING_FAILED) with Apache served pre-compressed .br (Brotli) files
How can I get Apache to serve pre-compresses Brotli files?
With Chrome I am getting
net::ERR_CONTENT_DECODING_FAILED 200
I made my pre-compressed .br (Brotli) files from minimized .html files (.min....
0
votes
1
answer
40
views
How to rewrite www to non www in nginx
I found a couple of other serverfault questions where rewrite www to non-www in nginx was answered, however it seems like with the nginx config my webdock.io server has the solutions I have tried seem ...
0
votes
0
answers
330
views
Apache URL rewrite to hide port numbers of web servers
I have an Ubuntu server running Gitea and Jenkins on ports 3000 and 4000 respectively. I want to be able to access them through a user friendly url like http://myhost/gitea and http://myhost/jenkins.
...
0
votes
0
answers
28
views
How do I rewrite a fake filename into a GET argument for a hidden file on nginx?
How to turn example.com/search.php?q=QUERY into example.com/s/QUERY
So that when you visit example.com/s/QUERY it executes example.com/search.php?q=QUERY
And also how do you block access to example....
0
votes
1
answer
100
views
nginx config for SEO friendly Laravel setup
I wasn't able to find an immediate solution to the 3rd item, below, so once I'd worked it out, I thought it would be helpful to post my general config for Laravel in order to help others searching for ...
0
votes
0
answers
163
views
How to rewrite a file URL in a reverse proxy upstream to a host local path?
I setup a Nginx reverse proxy virtual host as below:
location / {
proxy_pass http://127.0.0.1:8082;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Host $server_name;...
0
votes
1
answer
2k
views
IIS URL rewrite troubleshooting
I'm using IIS to reverse proxy HTTP requests to a nodejs app running in the same machine.
URL rewrite and ARR modules are installed and the proxy setting checked. The URL matching seems good: if I ...
0
votes
0
answers
50
views
Apache URL Rewrite Rule
I'm trying to configure the rewrite rules for my application, my requirement are
/aaa/bbb/ccc/ddd/ -> ./index.php?aaa=$1&bbb=$2&ccc=$3&ddd=$4
/aaa/bbb/ccc/ddd -> ./index.php?aaa=$1&...
0
votes
0
answers
313
views
Kubernetes Nginx Ingress url rewrite for dynamic id in url
I'm running a Kubernetes cluster on Azure Kubernetes Service(Aks). Currently, I'm having a service called product-service and I have exposed it to the outside using Nginx Ingress. My current ingress ...
0
votes
0
answers
340
views
IIS and reverse proxy outbound rules
I am trying to setup a reverse proxy using IIS 10 on Windows Server 2016 that must pass requests to an Apache Tomcat webapp.
It works for URLs within the 'basic' tags (such as a or img), but I need to ...
1
vote
1
answer
225
views
Apache 2.4 expr - how to load a html file via RewriteRule?
On Apache 2.4, Having a bunch of mixed SEO friendly and dynamic URLs on an ecom site I want to implement a simple caching system for my blog posts and product pages. First I want to have md5(...
0
votes
1
answer
122
views
nginx rewrite both .php and .html
Have 2 rules for working files with (html, php) prefix and without.
But working only first rule. If first php, second with html prefix show not found.
if (!-e $request_filename){
rewrite ^/([^\.]+)...
2
votes
1
answer
415
views
nginx: How to write regex to split URL into host and "everything else"?
I want to map
https://www.example.com/Something/SomethingElse/
to
https://www.example.com/index.php?/Something/SomethingElse/
So far I understood that I need the location directive in nginx and use ...
0
votes
1
answer
625
views
nginx url rewrite regex with special characters
How to write a regex that matches a path node with reserved characters like '+','-' ? for example:
https://e.example.com/foo+/bar/file/test.txt need to be re-written as https://e.example.com/bar/file/...
1
vote
0
answers
120
views
Cloudfront url routing to a domain
I have a cloudfront url I want to route to demo.example.com. I used nginx for the routing and configuration and generated the ssl certificate and then added the txt records in the DNS portal.
But when ...
0
votes
0
answers
83
views
NGINX rewrite url with arg
We need to check if a URL contains a specific arg "?___store=en" and then redirect to the same url, but add /en/ after the domain name. But this should be dynamic, because the url is not ...
1
vote
0
answers
114
views
Problems with excluding an url from being redirected
I'm retiring the legacy site http://extranet.contoso.com but there's a specific functionality that will be needed for a while still. What I'm trying to achieve is the redirection of all requests to an ...
-1
votes
1
answer
2k
views
IIS Redirect - Hostname to Alias with only HTTP Redirect
I have a Windows 2016 server (FQDN: server1.domain) in an Active Directory domain. I am hosting intranet web apps in IIS.
I recently got an alias (FQDN: CoolName.domain) for that server created in the ...
0
votes
1
answer
54
views
Nginx custom 301 rewrite
I am struggling to find how to write this scenario 301 redirect to nginx:
https://mydomain/$
to be converted
https://mydomain/en_us/$
Actually I need to add "en_us" just after mydomain and ...
0
votes
1
answer
279
views
RegEx for 301 redirects to change path AND remove a string
I am looking for an RegEX redirect rule to redirect the image file locations to a new location, whilst also removing part of the original url which is the name of the image
OLD URL:
/components/...
0
votes
1
answer
728
views
Writing a RewriteRule based on X-Forwarded-Host
I have an Apache webserver behind a load balancer which proxies request to Apache and have problem regarding configuring directories.
Here is my scenario:
Upper Load Balancer proxies request to ...
1
vote
1
answer
399
views
Nginx how to make redirect by removing part of URL with regex mask?
I need to redirect from URL like
example.com/some-urltext-nav.html to example.com/some-urltext.html (remove "-nav" only).
I've tried some regular expressions in server block like rewrite ^.*?...
1
vote
1
answer
670
views
Force https on all website except one on IIS
I followed this example "Best way to redirect all HTTP to HTTPS in IIS" for redirecting to https and it worked great.
I just have one website that is the exception. It has a few non-https ...