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

nginx - Attempt to redirect path with variable internally fails

i would like to redirect the request to a file from /path/to/file/content?path=file.pdf to /new/path/to/file/file.pdf under the same domain. I tried simple rewrite rules or like this. location ~ ^/...
Christian's user avatar
0 votes
1 answer
822 views

Why can I write one set of URLs but not others with NGINX?

I've set up NGINX, version 1.18.0, as reverse proxy for my Apache Superset 1.4.0 installation. I'm trying to capture some URL patterns, and rewrite them by adding standalone=1 at the end. The ...
Emre Sevinç's user avatar
1 vote
1 answer
156 views

Apache http to https WITHOUT any adress?

a normal http to https rewrite could look like this: RewriteEngine On # RewriteCond %{HTTP_HOST} !^example.com$ # RewriteRule /.* https://example.com/ [R] but this code specifies the site to "...
Adam Larsson's user avatar
0 votes
1 answer
996 views

Rewriting URLs with htaccess for multiple parameters

I'm trying to rewrite this: https://mywebsite.com/pages/article.html?id=1&title=Title-Goes-Here into https://mywebsite.com/pages/article/1/Title-Goes-Here Using this Rewrite Rule RewriteEngine ...
cat15ets's user avatar
2 votes
2 answers
8k views

Htaccess to rewrite URL with two parameters

I want to rewrite this type of URL https://mywebsite.com/content/page.html?id=12&title=my-page-title to https://mywebsite.com/12/my-page-title.html Using generateit.net/mod-rewrite/ I got the ...
cat15ets's user avatar
0 votes
1 answer
3k views

Redirect causes 404 error on nginx

How do I redirect if a user tries to direct access image files in browser only? I want to still keep the ability to allow social media sites to embed our images by hotlinking. I just want only if a ...
TravelWhere's user avatar
0 votes
0 answers
724 views

Bad nginx URI redirection

I am trying to authenticate in a keycloak server however the redirect_uri doesnt come with the context (/admin/). Nginx is producing a wrong URI redirect_uri: hxxps://***.pt/auth/realms/example/...
Winter's user avatar
  • 131
0 votes
0 answers
31 views

I just transfered domain name and now within my .htaccess file I have two codes which seem the same should one be deleted?

RewriteEngine On RewriteCond %{HTTP_HOST} lagiraudiere\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.lagiraudiere.com/$1 [R,L] and this one RewriteEngine On RewriteCond %{...
Paul Tom's user avatar
0 votes
1 answer
961 views

How to redirect user if direct access image files by browser? [nginx]

How do I redirect if a user tries to direct access image files in browser only? I want to keep the ability to embed images with <img src="...">. How to redirect from https://img....
TravelWhere's user avatar
1 vote
0 answers
154 views

When the ".php" at the end of PHP Files is removed, it becomes 302 redirect

I remove the .php file attachment in the application, but this time the application's action pages do not work. Because I removed the .php suffix at the end of the files. For example, I want to send ...
Emre6's user avatar
  • 151
4 votes
1 answer
984 views

use "rewrite" and "try_files" together [Nginx]

I removed the ".php" suffix at the end of the PHP files on the Nginx server with the following code, but this time I cannot send some data to the server. try_files $uri/ $uri.html $uri.php$...
Emre6's user avatar
  • 151
0 votes
0 answers
83 views

"rewrite" structure for subdomain on Nginx

I want to do a custom rewrite for the subdomain on ISPconfig. When I add the code below for this, the subdomain is redirected to the main domain. Sample #1: server { ... if ($http_host = "...
Emre6's user avatar
  • 151
4 votes
1 answer
2k views

Why the redirection in .htaccess not work?

I have a Wordpress website. I want to redirect .php urls to the ones without the .php suffix. The .htaccess is as follows: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On ...
peter's user avatar
  • 123
0 votes
0 answers
368 views

Nginx configuration for matching wildcard server_name to specific Symfony route

i have a Symfony 5 application at domain.tld with this basic nginx configuration: map "$http_cloudfront_forwarded_proto:$http_x_forwarded_proto" $cloudfront_proto { default "http&...
El Lobo Blanco's user avatar
1 vote
0 answers
1k views

IIS ARR 3.0 - Change Base Url in Web API Response body using Url Rewrite

I have a local IIS server hosting Asp.net Core 3.1 web API running at port 5000. Using wireguard the local server is connected with the public facing server. The public facing server also has IIS 10 ...
AbhiAbzs's user avatar
1 vote
0 answers
289 views

HAPROXY - redirect URL and keep the same URI

Im using haproxy to do redirections. Basically I have a URL ( https://google.com// ) and I want to keep the same URI and just redirect only the base url ( https://test.com//). For HAPROXY it has to be ...
drowzee's user avatar
  • 113
0 votes
0 answers
46 views

nginx rewrite rules: Rewrite https://Frontend/backend/Api/SelectAllBranch/ to https://Backend/Api/SelectAllBranch/ or .../SelectAllBranch

I'm using this configuration to nginx proxy reverso location /backend { rewrite ^/backend(.*)$ $1/ break; proxy_pass http://credentials-web-bff.cl-milugar:5000; proxy_redirect off; ...
Leopoldo Vasquez's user avatar
0 votes
1 answer
3k views

How to replace an url part through htaccess

As I am not able to change my URLs through my application, I try to just rewrite the URLs via .htaccess. I try to change my URLs from: https://example.com/mietgeraete_cat/stuffa/ To: https://example....
orx's user avatar
  • 101
1 vote
1 answer
871 views

Two different rewrite conditions in the same .htaccess?

I need to create a rewrite condition for two specific files, according to the requested path in the URL. It's possible? Condition 1: If the URL is example.com/admin go to admin.php?uri=params. That is:...
João Williams Balaniúc's user avatar
2 votes
1 answer
439 views

Exclude google doc embed iframe from nginx rewrite rule?

I hope that someone can help me here as I have very limited knowledge about server related stuff. I have a WordPress site where I want to limit the /wp-content/uploads/ directory access to logged in ...
bakar's user avatar
  • 21
0 votes
1 answer
1k views

NGINX rewrite URL on wordpress but getting 404

I have a WordPress website where my URLs are currently written as follows http://example.com/for-sale/12345-aaa-123-street-bbb-city/ and I would like to still serve the same URL, but I want the URL ...
David's user avatar
  • 1
0 votes
1 answer
972 views

NGINX Rewrite Rule for Slug [duplicate]

I am trying to create a rewrite rule in NGINX for a URL. The Original URL format is https://example.com/blog/article-slug-here but needs to be in this format: https://example.com/blog?article=article-...
TheKrisMoore's user avatar
0 votes
0 answers
154 views

Disable URL decoding in certain urls KEMP Load Balancer

So I recently set up GitLab in my server and I use the kemp load balancer to reverse proxy and also manage other rules and stuff but today I noticed that the web IDE wasn't working and after looking ...
DeadSec's user avatar
  • 139
0 votes
1 answer
1k views

IIS websites in subdirectory => HTML source requests to root "/" points to default website instead of subdirectory

Our IIS hosts our own website. But recently we have been tasked with hosting a third party website built using Laravel in a subdirectory. The website is loading, but most of the resources like CSS and ...
DerpyNerd's user avatar
  • 121
1 vote
1 answer
3k views

Using a part of the URI as a port number for nginx proxy_pass directive

This is my nginx configuration : server { listen 443 ssl; server_name sub.example.fr ; location ~ ^/ (123[0-9])$ { # regex work #rewrite ^/[0-9]{4}(.*)$ $1 last;...
themadmax's user avatar
  • 113
0 votes
0 answers
429 views

Nginx configure location rewrite for all subfolders

This question follows on in many ways from a previous one I had asked - and ended up answering myself. A brief summary of the problem I describe there and my solution to it I need to perform ...
DroidOS's user avatar
  • 173
0 votes
0 answers
419 views

Removing folder directories from a URL using Nginx

I am using YetiShare PHP Script I want to change this /plugins/rewards/site/rewards.php to /rewards.php or /rewards I have searched and tried all possible solutions on here and elsewhere to no ...
SXC's user avatar
  • 1
2 votes
1 answer
734 views

Apache .htaccess rewrite rules to NGINX converted rules not effective

I'm running a website "PHP script" on aaPanel with Debian 10 installed. All works ok but the images are not showing/broken The /image/ path is a rewrite rule, and it resolves to image.php ...
Anthonyinit's user avatar
0 votes
1 answer
104 views

Apache Rewrite to Nginx with ProxyPass

I'm trying to redirect an Subdomain hosted on an Apache Webserver* with .htaccess to an external URL with hiding this external URL. The .htaccess file looks like this: RewriteEngine On RewriteCond %{...
mauri5hut's user avatar
-1 votes
1 answer
181 views

How to direct a custom domain at a particular tweet [closed]

I have registered a new domain, let's call it particulartweet.com. I would like users who enter that domain in their browser to land on a particular Twitter URL, like https://twitter.com/wgervais/...
Cornelius Roemer's user avatar
0 votes
0 answers
146 views

Nginx prevent hotlinking and redirect not work with new Nginx version

In the past, this works perfectly: #domain1.com location /files/ { valid_referers none blocked domain1.com domain2.com domain3.com; if ($invalid_referer) { return 403; } if (!-...
Phạm Thanh Tùng's user avatar
2 votes
1 answer
2k views

wordpress internal redirect using nginx

I have a WordPress site with permalinks set to Post name. Using Nginx rewrite, I am trying to have an internal redirect (with no change in browser URL), but so far, I am failing. This works, but the ...
andrea's user avatar
  • 121
1 vote
0 answers
105 views

Apache Rewrite Permalinks on non-WordPress site

I've inherited a legacy PHP site running on Apache with a custom CMS. The URL structure is currently: https://example.com/topic.php?id=100&Title=Blog+Post+Topic Is there an easy(-ish) way to ...
Kevin Worthington's user avatar
1 vote
1 answer
389 views

Rewriterule not working with Joomla urls due to question mark and other special characters, also due to long urls

So I moved from Joomla CMS and now I need to finish my permanent redirects, but the following redirect isn't working (it's actually returning an error 404): RewriteCond %{HOST_NAME} =&?$ #...
Brave Warrior's user avatar
0 votes
1 answer
1k views

Nginx: URL rewrite with proxy_pass and URL parameters and special chars

I studied all the great posts to nginx proxy and rewrite functionality, but was unable to find a solution for my problem. So here we are. I wrote an web application with vaadin, that is able to handle ...
tausendschoen's user avatar
1 vote
1 answer
2k views

Rewrite Rule for URL with query does not work

I write the following rewrite rule: <IfModule mod_rewrite.c> RewriteCond %{QUERY_STRING} rp=\/knowledgebase\/.* RewriteRule ^\/customer\/index.php /knowledgebase/ [R=301,L] RewriteRule ^\/...
alancc's user avatar
  • 183
1 vote
1 answer
350 views

IIS stop bogus API

In IIS can it stop bogus API calls? Yesterday I got flooded with something that was trying to see if a page is on the site. They got the 404 but the application still had to check to see if that was a ...
Jefferson's user avatar
1 vote
0 answers
235 views

4D app with https via IIS reverse proxy not working

I am trying to set up a simple reverse proxy for http and https for a 4D app running on a windows server 2012 R2. I got http working but not https. When I open the public firewall and access the 4D ...
KarlAlois's user avatar
0 votes
1 answer
39 views

Nginx rewrites correctly for one but not the other

Basically, I am trying to use the proxy_pass directive to call a remote API. So far, this is what I got: server { location /a { proxy_pass https://a.com; rewrite ^/a(.*)$ $1 break; # no ...
Askirkela's user avatar
  • 131
1 vote
0 answers
89 views

WordPress Date Archives not working in Nginx

WordPress installed in a subdirectory: domain.com/folder WordPress Permalink Settings: domain.com/folder/%postname% Referencing the WordPress Nginx support article, I added the following to my nginx ...
webdev's user avatar
  • 11
0 votes
1 answer
790 views

how to allow proxy pass with same location, with multiple context path

server { listen 80; server_name example.com www.example.com; location /consol { if ($request_method !~ ^(GET|POST)$) { return 405 "Not allowed"; } ...
deepak's user avatar
  • 1
1 vote
1 answer
8k views

Append URL parameter to request URI using Nginx

I'm trying to append URL parameters to specific request URI's within the server block. This is what I have so far: if ( $request_uri = "/testing/signup" ) { rewrite ^ https://www.example....
Neil Simpson's user avatar
1 vote
0 answers
682 views

Nginx rewrite and return interfere with different location block

I have the following configuration in nginx for redirecting in a certain scenario. location /prefix-someurl { if (condition) { return 301 $scheme://$host/xyz.html; } proxy_pass ...
Syed Osama Maruf's user avatar
1 vote
1 answer
64 views

How to load requested file from sub-directory without rewriting base

Utilizing .htaccess rules, I'm attempting to load a file from within a sub-directory while keeping the frontend URL unchanged if both the domain and file path match criteria. Example of URL: example....
sparecycle's user avatar
1 vote
0 answers
214 views

IIS Rewrite module, simple rule

I am stuck on a very simple IIS rewrite rule. I have a series of links that have an invalid path, and I need to redirect all requests to that path to a new one. Here is the broken path: https://...
DragonZero's user avatar
4 votes
1 answer
2k views

htaccess rewrite /dir/*.jpg to /dir/webp/*.webp only when webp file exists

I'm trying to rewrite all website files (*.jpg|*.gif|*.png) to *.webp in a subdir, but only when the *.webp file exists. Previous and new files have the same name, only changing the extension and *....
Diego Flores's user avatar
0 votes
1 answer
2k views

Nginx rewrite urls within a single page app

I've been having issues with this nginx configuration, and after scouring this site, I'm wondering if it's even possible. I have a very simple single page app with the following routing: server { ...
confusedSPAcreator's user avatar
3 votes
1 answer
566 views

Effect of trailing question mark (?) in nginx rewrite directive's replacement URI

I'm trying to understand the difference between rewrite ^/search/(.*)$ /search.php?q=$1 and rewrite ^/search/(.*)$ /search.php?q=$1?. The difference is the trailing ? in the replacement URI. If the ...
Logan Lee's user avatar
  • 149
2 votes
1 answer
381 views

Apache .htaccess to NGINX RewriteRules Port

So, I am actually trying to port the RewriteRules from Apache to NGINX but it seems I am not able to completely port out. Actually, on my server I do have a running site on https://example.com domain ...
NoobAvi's user avatar
  • 23
0 votes
0 answers
918 views

Nginx proxy pass Server runs in port 4443 with lets encrypt ssl

I am trying to proxy java application runs on port 4443 using nginx. My nginx server block is like below: map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream ...
Madushan Perera's user avatar

1 2
3
4 5
43