url-rewriting

IIS Rules with React Router v4

与世无争的帅哥 提交于 2020-08-05 08:43:05
问题 I'm trying to get my routes to work with IIS and React Router v4 using BrowserRouter. On my localhost I have all my routes working as expected. React Router handles everything like I want it to: http://www.example.com/appfolder/dest http://www.example.com/appfolder/dest/CODE http://www.example.com/appfolder/dest/CODE/INVALID/URL Now, in IIS I've set up a rule that ignores '/appfolder/api/*' for the purpose of serving an api for my app. That works. How do I get IIS to redirect to 'http://www

Re-writing tomcat 8 urls

ぐ巨炮叔叔 提交于 2020-07-19 07:46:08
问题 I have two tomcat applications deployed under two different contexts: someurl.com/context1/ someurl.com/context2/ I need to intercept urls in the form: someurl.com/clientname/context1/ and redirect them to url: someurl.com/context1/clientname where "clientname" is dynamic I have tried using a rewrite valve in the element of my tomcats server.xml file, but it still works only for urls which include the context. i.e.: someurl.com/context1/clientname/context1 gets re-written to someurl.com

How to serve webp images using htaccess?

…衆ロ難τιáo~ 提交于 2020-07-16 06:48:23
问题 I would like to serve .webp images if the image (jpg or png) is available as webp. If not I want to show the jpg or png. RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^(.*)\.(jpe?g|png)(.*)$ $1.$2.webp [NC,L] AddType image/webp .webp The problem I need the final URL to be like: "myurl.com/foo.jpg.webp" If the webp file exists and if not I need: "myurl.com/foo.jpg" as a fallback solution. 回答1: If the requested URL ends in jpeg or png , you might test for

Redirecting ASP.NET Core 3.1 MVC Web App not working

点点圈 提交于 2020-07-10 10:26:31
问题 I've published a brand new out-of-the-box app in Azure App Service using a F1 (free) App Service Plan. I have the following class to redirect incoming request like www.mywebapp.azurewebsites.net/ to https://mywebapp.azurewebsites.net/ : public class NonWwwRule : IRule { public void ApplyRule(RewriteContext context) { var req = context.HttpContext.Request; var currentHost = req.Host; if (currentHost.Host.StartsWith("www.")) { var newHost = new HostString(currentHost.Host.Substring(4),

How to stop Spring Boot from adding session cookies?

六眼飞鱼酱① 提交于 2020-07-09 13:21:06
问题 I have a Spring Boot web application that I'm trying to make stateless. In my WebSecurityConfigurerAdapter I have set http .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) But the application (which uses Thymeleaf templates) keeps rewriting URLs for images and scripts by appending " ;jsessionid=<some_session_id> " to the file name. In addition to giving me a cookie I don't want, it also has the annoying side effect that Spring Security blocks the request because it

IIS Rewrite rules for languages and new domains

霸气de小男生 提交于 2020-06-29 03:37:08
问题 I need to create some rules (I thought that 2 would suffice) for the following scenarios: A. First scenario https://www.mydomainOLD.com/en/lorem/ipsum/doloret/etc to https://www.mydomainNEW.com/lorem/ipsum/doloret/etc Basically, I need to change the domain from mydomainOLD to mydomainNEW and remove "/en/" from URL when it appears. The rule I created is the following: <rule name="Replace OLD with NEW and remove /en/" enabled="true" stopProcessing="true"> <match url="^(http|https)://?(www.

.htaccess URL rewrite (remove folder from URL)

喜你入骨 提交于 2020-06-28 05:48:06
问题 Trying to show quarantine.country/coronavirus/dashboard/usa/ instead of quarantine.country/coronavirus/dashboard/region/usa/ at our covid-19 dashboard for US, using @anubhava's solution: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase /coronavirus/dashboard/ RewriteRule ^region/(.*)$ /$1 [L,NC,R] please let me know why the solution above doesn's seem to have the desired rewrite. Thank you! 回答1: You may use these rules in /coronavirus/dashboard/.htaccess

Merge two .htaccess files from two projects into one

江枫思渺然 提交于 2020-06-28 03:45:21
问题 I have a project which I have to include within a project. So .. project A is a web site built on top of custom framework which uses this .htaccess rewrite rules: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?url=$1 [PT,L] The second project B is built on top of another custom framework and I am supposed to make it look like a subfolder to the first one. So I placed project B inside a folder "subfolder". Project B has its own .htaccess

How to change URL on button click without page redirect in asp.net

被刻印的时光 ゝ 提交于 2020-06-23 14:40:49
问题 I have a page similar to this link which list items. All works fine. Just i am not able to rewrite the URL of a page on button clicked at different Levels. EG: when i click on Button "CellPhone" on Level1 div and later on click on Button "BlackBerry" which is on Level2 div then URL must be "www.somesite.com/cellphone/blackberry" and again when i click on Button "cellphone" i must change URL to "www.somesite.com/cellphone" Please can any one suggest me to do the same in asp.net. Note: I am