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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Nginx config rewrite .php working but forms broke

I am having trouble with the Nginx default config for my website. My PHP website runs on a linux azure machine, which uses nginx. This is currently my config: server { #proxy_cache cache; #...
5 votes
2 answers
7k views

nginx rewrite URL to redirect only if a cookie is not set

I have two domains www.domain.com and www.domain.com.tw. I want the user to be redirected to the closest server, but if they want to view the other server, they can by clicking a link in the site. I ...
0 votes
0 answers
50 views

Nginx as reverse proxy , rewrite or proxy pass request to docker container

I'm trying to use nginx as reverse proxy in front of a few applications which are on the same machine(Docker containers). As a test, I tried to connect PHPmyAdmin to a URI like: www.example.com/phpma ...
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
1 answer
31 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
24 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 ...
3 votes
2 answers
5k views

Apache ProxyPass to Tomcat - how to remove context path from URL?

I have Apache conf: <IfModule mod_ssl.c> <VirtualHost *:443> ServerName project.example.com ServerAlias ci ProxyRequests Off <Proxy *> Order deny,allow ...
1 vote
0 answers
33 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
55 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
2 answers
5k views

nginx 301 redirect to subfolder on primary domain

I just set up Wordpress on my VPS, so far it's the only item on my site. For SEO purposes, I think it's better to redirect the primary domain to the blog folder. So let's say the primary domain is ...
0 votes
2 answers
585 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....
4 votes
5 answers
6k views

Rewrite rule for nginx (Opencart)

Opencart has this URL structure: http://example.com/index.php?route=common/home http://example.com/index.php?route=account/register http://example.com/index.php?route=checkout/cart http://example.com/...
0 votes
1 answer
21k views

IIS URL Rewrite - Redirect root to subfolder

I want: http://somesite.com to redirect to http://somesite.com/subfolder Seems like a pretty simple request. I've followed the sources online, and they all indicate I should use ^$ for the regex ...
0 votes
1 answer
5k views

Nginx rewrite URI to remove a prefix?

I have a slim application that I would like to place under a directory path on a domain. Currently I have it working fine using the default slim file provided, but I would like to put a rewrite rule. ...
0 votes
1 answer
8k views

URL rewrite in IIS 8.5 is not working I'm getting 404 instead

Hi I've configured a rewrite rule on my IIS but it seems like it never gets fired I've been working on this for several hours without any luck this is my rule: ...
0 votes
2 answers
7k views

nginx check if filename with different extension exists

If a file with ".html" extension doesn't exist I need to know if the same file exists with ".th.html" extension and make a redirect. Right now on 404 I'm doing a rewrite and if $request_filename ...
3 votes
3 answers
4k views

How to configure apache as a reverse proxy with the remote server specified in a query string parameter

Problem: I'm trying to configure apache as a reverse proxy where the remove server is specified in a query string parameter. Let's say I'm serving a site at mywebapp.com. If you navigated to http:/...
0 votes
0 answers
67 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. ...
1 vote
1 answer
4k views

How to rewrite using htaccess if the file exists in another folder?

We are trying to rewrite to another folder if the file does not exist in the document root, but does exist in the other folder. The other folder is in a completely different location, which is ...
0 votes
1 answer
44 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 ...
2 votes
3 answers
9k views

Nginx: Rewrite while preserving the path

I want to set up a temporary redirect to another domain but I want to keep the path very similar. Here's an example: Request URL: https://api.mydomain.com/uploads/default/logo.png Rewritten URL should ...
1 vote
1 answer
6k views

Nginx rewrite or redirect for subfolder

I have a Debian 10 server with NGINX. And it is servering several domains. Let me explain the situation: I have setup my HTTP redirects permanently to HTTPS, in a file called redirect.conf. It is ...
0 votes
1 answer
54 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
174 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 ...
81 votes
2 answers
93k views

nginx url rewriting: difference between break and last

I don't understand the difference between break and last (flags of rewrite). The documentation is rather abstruse. I've tried to switch between the two in some of my configs, but I couldn't spot any ...
0 votes
1 answer
126 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
209 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
1 answer
83 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 ...
1 vote
1 answer
73 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....
0 votes
0 answers
39 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
3 answers
164 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
767 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
189 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
88 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
560 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
2 answers
684 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 ...
3 votes
2 answers
1k views

SEO friendly URL not working

I have a folder structure like the below www.exampe.com/distributor/index.php and I want to access the file via an SEO friendly www.example.com/distributer/abcinc and then in the index.php want to ...
1 vote
1 answer
143 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&...
0 votes
4 answers
6k views

Nginx URL virtual host rewrite issues with Magento e-commerce

I've been running into some problems with my URL rewrites. When I click a link in my Magento back-end it completely messes up the URL. We start with this link: http://icanttellmydomain.nl/index.php/...
0 votes
0 answers
70 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 ...
1 vote
1 answer
151 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
132 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&...
0 votes
0 answers
76 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
143 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
9k views

rewrite rule on nginx for css js files not work

I use laravel framework for my website on nginx server I need to apply rewrite rule on nginx its a sample: site.com/play/gamename/css.css --> site.com/uploads/games/gamename/css.css or site.com/...
2 votes
1 answer
4k views

How to use Nginx to both rewrite and proxy_pass whilst keeping the user-entered URL

I'm a beginner Nginx user trying to proxy the following: http://subdomain.example.com/mypage/login TO http://some_ip_address/login (not just /login - the site has other contexts too e.g. /static, /...
2 votes
2 answers
4k views

any url rewrite rule causes internal server error on iis7

I have iis7 on a Windows server 2008 and iis url rewrite module 2 installed. Any url rewrite rule (in my case a simple canonical domain name rule) causes the webapp to return an error 500. In my ...
1 vote
1 answer
4k views

Why does a RewriteCond %{REQUEST_URI} interfere with a second NOT condition?

At first the rule that works: DirectoryIndex index.php ErrorDocument 403 /form.html RewriteCond %{REQUEST_URI} ^/index\.php$ RewriteCond %{REQUEST_METHOD} !POST RewriteRule . - [F,L] This means ...
2 votes
1 answer
342 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 ...
80 votes
11 answers
71k views

Remove "www" and redirect to "https" with nginx

I want to create a rule in nginx that does two things: Removes the "www." from the request URI Redirects to "https" if the request URI is "http" There are plenty of examples of how to do each of ...

1
2 3 4 5
43