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.
Questions tagged [rewrite]
36 questions
5
votes
2 answers
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 commands:
sudo iptables --flush
sudo iptables --table…
Johan
- 51
- 3
5
votes
1 answer
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:
To:
Bcc:…
alienth
- 2,187
- 12
- 20
5
votes
1 answer
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 but I don't know how to change it
RewriteEngine…
antiks
- 409
- 2
- 7
- 12
4
votes
3 answers
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:
Order deny,allow
Deny from all
If I go to www.mysite.com/foo/foo2/file.xml, I can view the…
stecog
- 2,221
- 10
- 29
- 39
3
votes
1 answer
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 &Y. I'd be glad if someone let me know what rule I should…
Parsa Samet
- 767
- 1
- 7
- 20
3
votes
1 answer
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 break;
}
}
It's leading me through a…
Parsa Samet
- 767
- 1
- 7
- 20
2
votes
3 answers
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 domain.b/foo/ in browser address bar.
gruntboy
- 386
- 2
- 6
2
votes
1 answer
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 example 10.10.0.20, and then I'd like to return the…
Daneel
- 888
- 8
- 9
2
votes
2 answers
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 was to add www to a URL www.example.com.au
I tried…
Zama Ques
- 3,186
- 12
- 39
- 54
2
votes
2 answers
Virtual hosting a tomcat webapp in Apache on RHEL 5.0
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/webapp
Instead I want him to type:…
Abhishek
- 21
- 1
- 2
2
votes
0 answers
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 rewritten in [email protected].
Some contacts…
wie5Ooma
- 440
- 1
- 4
- 13
2
votes
1 answer
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.168.1.4) or (IP != 192.168.1.5)
or (IP !=…
Nidal
- 8,856
- 11
- 55
- 74
1
vote
1 answer
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 google for foo.org then on the search page there…
LanceBaynes
- 39,295
- 97
- 250
- 349
1
vote
0 answers
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-file = (
"^/(.*)$" =>…
Leandros
- 712
- 2
- 7
- 16
1
vote
2 answers
URL rewriting for root of website
This is the configuration of my Apache 2.4.37 webserver on Centos 8.
File /etc/httpd/conf.d/mysite.conf:
ServerName mysite.com
DocumentRoot "/var/www/html"
RewriteEngine on
RewriteCond %{SERVER_NAME}…
dr_
- 28,763
- 21
- 89
- 133