New answers tagged

0

Found the answer and wanted to post here in case someone else runs across the issue. Per http://stackoverflow.com/a/23600821/132528: Could Application Request Routing be involved? Look at IIS -> Machine or Site -> Application Request Routing Cache -> Server Proxy Settings and uncheck the "Reverse rewrite host in response headers" checkbox. If you do ...


0

You don't need the error_page directive here, since you already have @thengine as the last part in your try_files directive. To answer the actual question, I need clarification what you actually want to happen..


1

I'm not too up to date on Mutiviews but I do know a lot about google. You are better off getting rid the .html if you can. Google now have a section in search console (aka webmaster tools) that allows you to request the googlebot to scan your site. It renders the site both how the bot reads the site and how the bot interprets how a user would view the site. ...


0

Rewriting to a different port works but the port will not be left out. This rule will rewrite the request to port 8025 but the port will be included in the URL. If that does not do what you want you will need to use Application Request Routing which as you probably suspect is a reverse proxy.


-1

This one should work. With a little help from rewrite engine. It is not full as you still need to check for non-existent file. location /your_location { try_files $uri $uri/ @rewrite; } location @rewrite { if (!-e $request_filename) { rewrite ^/(.*)\.html$ /$1.th.html last; } } Wrong answer: What if you try something like this: try_files ...


0

Not likely! When the "change" shows in the browser address bar, it is because the server has sent a "redirection header" to the client (i.e. browser) with response code 301, 302, etc. instructing the client to send the request again to the correct address. The client will then, of course, hit the server with that address and if it is not valid the server ...


0

Add Options -Multiviews in the .htaccess file. Answered by Adam but wasn't visible so here it is, it works!


0

You are most of the way there. Try this: RewriteRule "^/foo/(this|that|anotherthing)/bar/(.+)(\/.+)?" "/${map:$2}" I removed the pipe in the second capture group and moved the question mark to the outside. This makes the entire capture group optional, and if it is present then it must start with a forward slash. I also changed the .* instances to .+ since ...


0

It seems that the problem is the extra $ in the rewrite rule (in the first argument). I removed it and it has started working fine. location /test { rewrite ^/test/(.*) /$1 break; proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header ...


0

Figure it out, I didn't realize that the GUI updates: c:\Windows\System32\inetsrv\config\applicationHost.config Once I added the following piece to that file on the Win2012 machine, it began working as expected. <system.webServer> <proxy enabled="true" /> </system.webServer> Silly me, I thought an inbound rewrite rule to an external ...


2

Your RewriteCond for the *.443 section has an obvious issue with it. HTTPS (typically) runs on port 443 (as the VirtualHost configuration shows) but your rewrite condition says 'If the server port is not 80, redirect to https://...'. So, hit port 443, ask for content, get told to go to 443 because you're not on 80. That's a loop. RewriteCond ...


0

Yes, Absolutely possible with mod_rewrite. Suppose your Query parameters are /a=1&b=2 Your rewrite rule will look like below RewriteCond %{QUERY_STRING} ^a=(.*)$ RewriteCond %{QUERY_STRING} ^b=(.*)$ RewriteRule ^(.*)$ http://localhost:8080/$1?b=%2&a=%1 [P,L] Where localhost:8080 is your backend application server, I haven't tried this, but should ...


0

Your rewrite won't perform a redirect, but will do something more akin to an internal forward. Assuming you want a 301 sent, then you'd do: rewrite ^(.*/)mobile$ $1 permanent;


0

RewriteRule (.*) /staticfile.html? Per the Apache RewriteRule documentation, By default, the query string is passed through unchanged. * * * * * When you want to erase an existing query string, end the substitution string with just a question mark.



Top 50 recent answers are included