Stack Exchange Network

Stack Exchange network consists of 175 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 processed as if the original request was made to the modified URL. This is often used to provide more search engine friendly URLs.

0
votes
1answer
7 views

Apache RewriteMap with wildcard

We want to migrate multiple domains on new servers. In the first step (though from a SEO point of this is not recommendable) everything has to be redirected to the new domain's root. Later the team ...
-2
votes
0answers
23 views

Nginx rewrite response in reverse proxy to point back to initial location

Problem Smart apps - solution exists Lots of applications have the concept of a "context path" which allows them to run easily behind a reverse proxy. The configuration for this would be simple: ...
-1
votes
1answer
4k views

NGINX rewrite rules not working

I am playing with NGINX rewrite rules, but no matter what I do, things wont work. The current link: /tutorials/index.php?article=2 How I want it /tutorials/2 My - current - NGINX rewrite conf/...
1
vote
0answers
166 views

Correct configuration of nginx for rewrite and access control

Here is my current nginx config server_name web.com; server_tokens off; root /usr/share/nginx/html/web; index index.php; if ( $request_uri ~ "/index.(php|html?)" ) { rewrite ^ /$1 permanent; } ...
0
votes
2answers
362 views

An optimal way of nginx rewrite rule building for pretty URL

The webpages are accecced in the following manner: example.com/?site=website In this example, I'm accessing the website located on example.com domain. Could anyone suggest an optimal way of ...
0
votes
1answer
426 views

Rewrite rule nginx, token

I have a java application which is behind nginx proxy pass. When the URL is called the application automatically creates a path for the served content. So when you call https://somedomain.com you get ...
1
vote
1answer
368 views

Replace single quotes for strings divided by blank space from variable

I'm writing a bash script where I'm reading in a variable via read this two strings: log.*.console.log log.*.log They are separated by space. How can I rewrite the strings that the output from the ...
1
vote
0answers
175 views

Apache redirect rule using regex

Hello I am trying to do a regular expression for an apache rewrite rule that handle request with no slash at the end and no extension an example https://www.some.thing.com/life-health-insurance ...
3
votes
1answer
625 views

Rewrite rule doesn't work in NGINX

Consider a URL as shown below: http://myDomain.tld/anAddress/myFile.pdf?X=zzz&Y=kkk How can I have it as : http://myDomain.tld/anAddress/myFile.pdf/zzz/kkk I want to get rid of both ?X and &...
3
votes
1answer
344 views

Rewrite doesn't work expectedly in NGINX

I'm using the following syntax for my rewrite in NGINX, and as far as I see it's working right! : location / { if (!-e $request_filename){ rewrite ^(.+)$ /index.php?url=$1 ...
1
vote
3answers
4k views

Nginx redirect/rewrite a domain.a to domain.b/foo/ without changing a url

I have a problem with the implementation of such redirect: https://domain.a/ => https://domain.b/foo/ without changing a url to domain.b. I would like to see the contents of the URL domain.a from ...
1
vote
1answer
436 views

postfix rewrite destination of mails from specific server group

Hi I have smtp server on a local network and all other local machines send emails through this one (mastersmtp.lo.cal 10.10.10.10). I need to rewrite all TO/destination address from test1.lo.cal (10....
1
vote
1answer
155 views

Redirect all example.com/paths that don't start with example.com/wiki to example.com/wiki - NginX Proxy

I recently moved my site from Wordpress to confluence, and I'm having trouble with page redirects. Ive setup a custom 404 page for my Confluence, but it only works if you type https://www....
5
votes
2answers
749 views

How to override dns server in nat gateway (iptables)

I have an Ubuntu server running openvpn, and iptables is used to push all incoming traffic through the vpn server. The IP tables config is very basic, and generated with the following series of ...
3
votes
1answer
1k views

How to blackhole an external address in an exim relay server without rewriting?

I have a scenario where email is sent through my outbound relay with a do-not-reply 'To:' recipient (the actual recipients are BCCd). Example of what these emails look like: From: <from@mydomain....
0
votes
1answer
75 views

pattern regex for apache rewrite

I have a bunch of URLs counting to thousands i need to redirect and there are thre main patterns in URL first pattern There is a dash - starting the title url and want to remove that dash e..g www....
1
vote
1answer
2k views

Apache redirect to https if the request is not from localhost

I have a Centos 6.7 with apache 2.2.15. I want to redirect all traffic from port 80 to 443 with one exception. The traffic who come from localhost I want to remain on port 80. Now I use this config ...
1
vote
2answers
82 views

Reformatting Apache RewriteRule

I have these variant of urls RewriteRule ^/trendy/the-reason-for-example/? http://www.example.com/trendy/the-reason [NC, L, R=301] RewriteRule ^/lol/2015/10..._for-example http://www.example.com/lol/...
0
votes
1answer
466 views

URL rewriting and internal links on Apache

I have a 2.2 Apache with the weblogic plugin enabled, which it simply redirects all the requests to the application server. Basically, when I call the page http://myip/blabla/home.page, it is a page ...
2
votes
1answer
2k views

Rewrite source IP in TCP replies using iptables

I'd like to rewrite the source IP on TCP/514 traffic leaving a redhat machine, for connections that weren't initiated from the machine. The machine receives TCP/514 traffic on an interface, for ...
2
votes
2answers
493 views

Adding www to URL : not working

This is further to the redirect query which I posted earlier in this group . Redirect rule for Apache : Adding www to URL It is still not working for me , so re-posting the same query . The query ...
1
vote
3answers
9k views

Deny access to subfolder and file with .htaccess

I need to deny access to configuration files under some subfolder. Currently I have this rule but it doesn't work: <Files ~ "((foo|bar))$"> Order deny,allow Deny from all </Files> If ...
1
vote
0answers
644 views

postfix sender mailaddress rewrite based on recipient mailaddress

I use postfix to send out mails to my contacts. Usually I use the info address for this and I've set a rule to rewrite my internal address into a valid mail address. So for example me@localhost gets ...
0
votes
0answers
299 views

Nginx rewrite rules

good day, anyone can help me convert this .htaccess to nginx ? <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^data/([0-9]+)/(.*).html$ index.php?dir=$1 [QSA,L] RewriteRule ^data/file/([...
1
vote
0answers
594 views

nginx serves info.php but doesn't serve index.php [closed]

info.php with basic phpinfo() is served when I enter info.php in the url, however index.php is not being served. I tweaked around some changes reading different answers on stackexchange: `try_files $...
2
votes
1answer
414 views

Forbid some IPs from a certain Network on Apache?

I want to redirect all the inside network IPs (and only the inside network "192.168.1.0") to an error page except some IPs, A condition like this: if ( IP_from_Network = 192.168.1.0 and ((IP != 192....
1
vote
1answer
122 views

How can I rewrite with apache mod_rewrite an entire directory?

I need this URL/directory make/lores/some/ to point/map to login/ I also need to rewrite .php extensions to .html Example When the client types in example.com/make/lores/some/login.html the server ...
1
vote
1answer
231 views

htaccess Rewrite Issue

I have been attempting to correct an issue that I'm experiencing with WordPress. Following the advice on the WordPress.SE site I've tried to resolve it with an .htaccess rewrite rule, but for some ...
0
votes
0answers
135 views

nginx should not handle unicorn's request

I have a server on which I have configured Nginx and Unicorn, where Unicorn servers static pages. In my case I'm writing a rewrite rule in Nginx that, if a request comes to mydomain.com it should ...
1
vote
0answers
413 views

Lighttpd rewrite rule

Why does a rewrite rule like this not work: url.rewrite-if-not-file = ( "^parameter/(.*)$" => "/somefunnyfile.php?someparameter=$1" ) ... but a rule like this does work: url.rewrite-if-not-...
0
votes
1answer
1k views

Why is rewriting in htaccess not working on this server

I'm moving code from a server that served a single domain to one that serves multiple domains. I'm using named virtual hosts to handle the different domains. The url rewriting is not being executed I ...
2
votes
2answers
3k views

Virtual hosting a tomcat webapp in Apache on RHEL 5.0 [closed]

I am in a hosting fix! I have developed a web app for my organisation that allows sharing, interacting, etc. I want to DEPLOY IT ON LAN. BUT... I don't want the end user to type: 10.21.34.56:8080/...
1
vote
1answer
998 views

privoxy: rewrite html “http” links to “https”

I'm using the Privoxy proxy on my PC. What is the rewrite rule in the user.action file to rewrite e.g.: http://foo.org to https://foo.org? Note that I want to rewrite, not redirect. So if I search ...