Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
0answers
10 views

404 on script URL after switching server from Apache to NGINX

I have a woocommerce site that runs a script for accounts that has stopped working after moving from Apache to Nginx. example.com/zynk/index.php/wp_posts?select=ID,meta_value&where=post_type.... ...
0
votes
0answers
13 views

Convert symbol in url

I have a multiplier symbol in url that I would like to convert to x. Like convert any "×" to "x" in url. How to do that via htaccess or nginx rewrite rules? thanks
2
votes
1answer
54 views

Apache .htaccess RewriteRule and ErrorDocument

I have a .htaccess file : RewriteEngine On DirectorySlash Off RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.mp4|\.ttf|\.eot|\.woff)$ RewriteRule ^(.*)$ ?page=$1 [NC,L,QSA] ErrorDocument ...
0
votes
0answers
32 views

NGINX: How to run 2 Wordress apps under 1 domain?

Hi I have 2 Wordpress apps running under nginx: App 1 at localhost:9990 (/var/www/app_1/public_html) App 2 at localhost:9991 (/var/www/app_2/public_html) Is it possible to make App 2 a child of App ...
0
votes
0answers
13 views

Migrate Apache RewriteRule to haproxy http-request redirect

We have a lot RewriteRules in our Apache config files. Now we have to migrate these rules to haproxy. For Example: RewriteCond %{HTTP_HOST} ^app.mydomain.com* RewriteRule ^/$ https://app.mydomain....
0
votes
1answer
18 views

Nginx caching reverse proxy with URL rewrite

I am serving large static files from a backend storage server with slow spinning disks. This server is hidden behind fast nginx reverse proxy with local cache on SSD. It works great and fast. Now I ...
1
vote
0answers
198 views

NGINX remove all extension types in uri

How would I remove all extension types in the uri through nginx config. I have looked around for solutions and only found solutions for specific file types. For example some configurations would ...
4
votes
0answers
23 views

Trying to get Friendly URL's to work

I have been working on getting friendly URLs to work. On my site I have something like this: http://www.example.com/blog/newpost.php?id=Reasons+to+Use+a+Small+Business+Consultant I would like it ...
1
vote
1answer
21 views

Nginx rewrites taking precedence over redirects?

I have some redirects set up in an include file for our nginx config. I noticed the other day that some redirects aren't working, and they seem to just be the ones that are impacted by rewrite rules. ...
0
votes
1answer
34 views

Rules, URL Rewrite

I'm trying to rewrite two URLs. /Inicio.aspx to /Home and /Usuario/Solicitud.aspx to /Usuario/Solicitudes with the module rewrite of IIS. I made my rules: and put the code in the web.config <...
1
vote
1answer
20 views

IIS URL Rewrite: Match subdomain and redirect to HTTPS

Suppose the website URL is subdomain.company.com I want to redirect the user to https://subdomain.company.com only if The original request is not using https subdomain matches subdomain.comapny.com ...
0
votes
0answers
7 views

Asp.net URL Redirect not working though test is passing in IIS

Blockquote I have asp.net web application and added a entry for URL Redirect. I tested the URL redirect in iis and the test gets passed. Here is the URL redirect rule I am using. <match url="(.*)...
3
votes
1answer
15 views

Regex rewriting with map

I have a url.map containing a rewrite rule ~^/A/shopby/(?<brand>[a-zA-Z]+) ~^/category/by-brand/$brand; so that /A/shopby/a_brand will be redirect to /category/by-brand/a_brand And also a ...
0
votes
2answers
71 views

RewriteRule Irrespective of Trailing Slash in .htaccess

I want to redirect URLs irrespective of trailing slashes. The reason is because my site enforces trailing slashes by default; if an internal link is missing the trailing slash then I have a redirect ...
1
vote
1answer
35 views

Nginx to redirect to specific PHP

I wanted to rewrite the url path to point to certain PHP. Here is the flow: User Login https://admin.abc.com After they logged in, the system will pass url to be redirected https://admin.abc.com/...
0
votes
0answers
43 views

Redirect URL with a subsequent direct URL as parameter has wrong port via nginx proxy

I have an existing service (MyApp) for which I wish to put an nginx proxy in front of. MyApp is directly accessible via: https://host123.example.com:8080/ The URL to access via the nginx proxy is: ...
2
votes
0answers
37 views

Regex RewriteRule in Apache 2.4 .htaccess

I want the URL: http://api.relaunch.local/rest/v1/akb/ To rewrite to: http://api.relaunch.local/?id=1873&eID=dispatch&controller=akb Where akb is the variable part. I tried endless ...
0
votes
1answer
43 views

Port .htaccess rewrite rule to Nginx

I'm moving from Apache to Nginx and would like to 'port' a rule from my htaccess file: RewriteRule ^api/(.*) slim/index.php [QSA,L] How can I do this in Nginx? An example of a request-url that ...
2
votes
1answer
59 views

NGINX Rewrite subdomain with multiple . as -

On my NGINX server, I am rewriting usernames as a subdomain. However, the server that I inherited, the initial names have a "." to separate out two names. For example: http://foo.com/john.smith is ...
0
votes
3answers
98 views

What's a good way to hide “wordpress” from a WordPress URL?

I have an Apache2 web site with several different resources all installed directly under the DocumentRoot: http://example.com/mycodeigniterapp http://example.com/wordpress http://example.com/...
0
votes
0answers
7 views

Apache Server Htaccess [duplicate]

How to redirect pages without extension to .html ? For example I want the following page : [https://volexlabmultimedia.com/multimedia-service-lucknow][1] To be redirected to: [https://...
-1
votes
1answer
134 views

Rewrite host header in HAProxy

Trying to rewrite the host header in HAProxy, but can't figure how to do it right. I need the to rewite to another domain. Users access the webpage on URI: site1.dev.example.com and I need to ...
1
vote
0answers
23 views

URL rewrite is not working as expected IIS7

I am trying to achieve the following rewrite URL in IIS 7: subdomain.domain.com/username should become subdomain.domain.com/?username When I try to match the pattern /([^/]+) and test it with /...
9
votes
1answer
325 views

Nginx simple redirect of products from old to new category

I'm making redirects of products from old to new category. I've managed to make it work with following rule: rewrite ^/old-category/(.*) /new-category/$1; But I want to know when should I use "end ...
0
votes
0answers
31 views

IIS redirecting SSL requests to another server

I have two servers, one is Microsoft with Exchange 2010, and the other is Debian with Apache web server, so both of them need 443 port. Exchange needs it for Outlook Anywhere, and Apache needs for ...
0
votes
1answer
77 views

IIS Application Request Routing ignore certificate

I use one of development sites as URL rewrite to access other sites. Unfortunately one of the sites has a certificate error because we access it under VPN under different IP. IIS says that the ...
0
votes
1answer
51 views

Apache redirect Absolue url to relative url

So I want to load a web-app from a subfolder. Current configuration looks like this <VirtualHost *:80> ServerName YOUR IP ADDRESS/DOMAIN ServerAdmin webmaster@localhost ...
1
vote
1answer
108 views

Editable URL Rewrite Map for CloudFront/S3 Website using Lambda@Edge

I'm migrating a static website from IIS to Amazon S3, using CloudFront for https. The old site used the URL Rewrite module and had 301 redirect maps with over 200 entries. Here is an example: example....
0
votes
0answers
33 views

How to use Apache forward proxy server to rewrite URLs?

So I have successfully set up an apache HTTP server as a forward proxy. Next, how should I modify the configuration file so that clients type ANY URLs, and the proxy rewrites the URL to something else?...
0
votes
0answers
22 views

Redirect rules for two separate catch-alls

I am not a systems admin and am struggling getting some .htaccess rules to play nice. The issue is I need a two-tiered fallback. Sample directory structure: /public_htmlindex.html (vue app with ...
1
vote
1answer
44 views

htaccess issues with non existent files in non existent directories [duplicate]

I am using the following .htaccess file, which works well, however, I want to also forward any attempts to access non-existent files in the root directory and in any subdirectory (whether the ...
0
votes
0answers
50 views

nginx rewrite all static excluding directory

I have these codes and it works fine, but with this way i should permanently indicate all directories to redirect. But there are a huge ammount of directories in my server.... location ~ ^(/akkerman-...
0
votes
0answers
22 views

Keep encoded URLs when rewriting in Nginx

I have a rewrite which rewrites /test/id/:urlencoded to /test/:urlencoded location ~ /test/id/ { rewrite ^/test/id/(.*)$ /test/$1 redirect; } It looks like Nginx decodes the captured portion. For ...
2
votes
1answer
132 views

How to redirect with query string in Nginx

I would like to redirect: something.com/search?keywords='value' to something.com/search?q='value' Here is my Nginx config: location ~ /search { if ($args ~* "keywords=(.*)") { ...
0
votes
1answer
35 views

nginx URL Redirect

Excerpt from conf file server { #HTTP SITE listen 80; server_name example.tv www.example.tv; #Redirect HTTP to HTTPS location / { return 301 https://example.tv$request_uri; ...
0
votes
0answers
15 views

IIS Rewrite language on all matched URL's

I'm trying to write a rule in my IIS that replaces all URL's that are matched with the turkish language to the english language. example: I want http://example.com/test.aspx?lang=tr to be forwarded ...
0
votes
0answers
22 views

How to setup web.config and IIS for second and separate FQDN in IIS on same ports

I've got an existing website that is running on 80 and 443 with SSL already. I have a second FQDN that needs to access a different web application. My second application is Seafile. I've followed ...
0
votes
1answer
24 views

IIS and Apache rewrites and redirects working together

I'm having some trouble with IIS and apache working on the same server. Specifically, any redirects that apache does don't replace the website domain with the target domain. Here's an example: Trying ...
0
votes
2answers
296 views

nginx rewrite url without changing browser address

I want to change the url of a request but the browser address should not change. To achieve this I have tried the below configuration: location /my-website { proxy_pass http://tomcat/...
-2
votes
2answers
40 views

Browser does not have rewritten URL with query string

When I rewrite the URL by adding a query string, the URL in the browser does not have the query string. Here's what I have: location / { rewrite ^/$ /?page=test break; } Instead, I see the ...
0
votes
0answers
21 views

reroute request by port in iis7

I'm trying to set a webapp in iis 7 to forward requests to a specific port to a controller inside the website. I need that every request sent to http://server:6035/{QUERY} will be rerouted to http://...
0
votes
1answer
25 views

Redirect in nginx port not showing up

I have the following configuration. I'm trying to redirect the http traffic to port 8443. I'm running gogs on different ports and am using some tricks to get to it. Now our main portal is guarded by ...
1
vote
0answers
52 views

How to manage URL rewrites with a GCP load balancer?

We have a single-page web application deployed on a GCP bucket with a load balancer in front of it. All URLs such as example.com/login should be rewritten as example.com/#/login. Without being ...
0
votes
0answers
13 views

IIS URL WWW Rewrite Working, But Can Be Gotten Around

I have the following rewrite rules to add www when someone visits our sites: <rule name="non-www to www http" enabled="true" stopProcessing="true"> <match url=".*" /> <...
0
votes
0answers
67 views

nGinx Case Insensitive Rewrite Causing Redirect Loop

I am attempting to get my case-insensitive rewrite correct, and am running into what looks like a redirect loop issue My config block is location ~* ^/email { rewrite (?i)^/email/(.*)$ $scheme://...
1
vote
1answer
63 views

.htaccess 301 redirect remove [] from the URL

I want to remove '[' and ']' from the URLs and redirect to correct link. Here is a sample URL: /forums/garage-150/cool-cars-sightings-[archived]-7610/index127.html Needs to be redirected to: /...
0
votes
0answers
31 views

rewrite url for proxy and preserve original url for client

I have an issue with nginx and proxying. There are two aplications which serve requests on :8080 port and I'd like to setup nginx proxy and connect to applications using following urls: http://domain/...
0
votes
1answer
287 views

nginx rewrite if query string exists

In the past a project was getting moved from / to /subdir. As the old URL structure was something like /index.php?foo/123/bar I used the following rewrite to get everything to /forum: rewrite ^\/...
2
votes
1answer
248 views

Redirect to %-encoded URL parameter using mod_rewrite in .htaccess

There's a couple of things I'm trying to understand in relation to a RewriteRule. The working rule on a URL strips a query back to a redirect, eg. the URL: https://www.example.com/application?user=...
0
votes
1answer
265 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/...