url-rewriting

IIS Rewrite Rule in web.config to redirect HTTPS requests to HTTP

烈酒焚心 提交于 2019-12-18 16:51:18
问题 I need to redirect all https requests to http, for example, if someone visits https://www.example.com/another-page/ to http://www.example.com/another-page/ I have the following rewrite rule in my web.config right now, but it's not working correctly. It's redirecting https://www.example.com/another-page/ to https://www.example.com/, so to the root of the site, but instead I want the redirect to stay in the same URL and only rewrite https to http. <rule name="Redirect to HTTP" stopProcessing=

Change URL Rewrite Rule in Web.Config from Code C#

大兔子大兔子 提交于 2019-12-18 15:40:08
问题 I want to modify rewrite rule from C# code. Url Rewrite rule is resides in web.config file. <system.webServer> <rewrite> <rules> <rule name="partners"> <match url="^partners$" /> <action type="Rewrite" url="partners.aspx" /> </rule> <rule name="news"> <match url="^news$" /> <action type="Rewrite" url="news.aspx" /> </rule> <rule name="projects"> <match url="^projects$" /> <action type="Rewrite" url="projects.aspx" /> </rule> </rules> </rewrite> </system.webServer> I want to change for ex.

mod rewrite directory if file/folder not found

不羁岁月 提交于 2019-12-18 13:29:20
问题 I have a folder named "folder1" in my root directory www.domain.com/ www.domain.com/folder1 I need to redirect all the requests to www.domain.com that turn up to be a 404 error, to folder1. Like so: www.domain.com/a_file.txt If a_file.txt doesn't exist, look in folder1: www.domain.com/folder1/a_file.txt I want this to work the same for subdirectories, like so: www.domain.com/a_folder (redirect if it doesn't exist in the root) www.domain.com/folder1/a_folder I know I should use RewriteCond %

.htaccess rewrite subdomain to directory and keep subdomain in url

断了今生、忘了曾经 提交于 2019-12-18 12:33:09
问题 I need to rewrite a subdomain to a subdirectory using .htaccess but keep the subdomain in the url like this: Visited url in browser: sub1.domain.com Served url: sub.domain.com/sub1/ I tried the following RewriteCond %{HTTP_HOST} ^subdomain.domain.com RewriteRule ^(.*)$ http://subdomain.domain.com/subdomain/$1 [L,NC,QSA] but this leads to an endless loop. I know that it would be easier to do this by php but is there any solution for this with using .htaccess? 回答1: You can use this rule in

URL Rewrite on IIS from http to https is not working,

点点圈 提交于 2019-12-18 12:07:22
问题 I have a problem. On IIS I got a web-site with two ports 80 and 443(https) . I want to redirect all the http requests from user to https . I also added Rewrite rule to https , but when I enter in browser http://localhost/site it gives me the same page. I need to redirect user to httpS://localhost/site . Maybe this is because of my local configurations? And I disable Require SSL on IIS . The rule is: <rewrite> <rules> <rule name="HTTPS Redirect"> <match url="(.*)" ignoreCase="false" />

How to Redirect to a url containing an anchor (#)?

会有一股神秘感。 提交于 2019-12-18 12:02:08
问题 I need to take standard incoming urls and rewrite redirect them to target specific anchors on a single page (incoming html page name becomes the anchor name). E.g., the rule would be like this: RewriteRule ^files/([a-zA-Z0-9\-_]+)\.html$ /test.html#$1 [R] So this url: http://foo.com/files/bar.html ...would become: http://foo.com/test.html#bar The rule itself works fine, but the # character gets encoded in the browser address bar to: http://foo.com/test.html%23bar which of course does not work

best practice to use action url while calling ajax in cakePHP

拈花ヽ惹草 提交于 2019-12-18 11:13:46
问题 I am using ajax with jQuery in my cakePHP application. and my javascript function is placed inside a javascript file. now in my local system the files are kept in "/sample" directory so the the path while i call the function will be in ajax.js $.post({url : "/sample/controller/action"}) but after hosting it the url will become $.post({url : "/mydomain.com/controller/action"}) in cakePHP we $html->url to generate urls but since this code is in js file i can't use that function i don't want to

Mod rewrite query parameter validation and blocking also request url blocking

戏子无情 提交于 2019-12-18 09:18:07
问题 On my site, only few query query parameters are allowed but, some scanners or hackers trying to access url with unique parameters which my php application doesn't support, I can block them in php application level, by validating $_GET parameters, but my server is getting loaded, so I want to show 403 if parameters are not valid Query parameters can be in any order So far what I tried is as follows # IF there is query string RewriteCond %{QUERY_STRING} ^.+$ # Then parameters can be only query

HTTPModule BeginRequest should us Response.Redirect or Server.Transfer

核能气质少年 提交于 2019-12-18 09:07:21
问题 We have a URLRewriting module that is using a Response.Redirect in the BeginRequest event method to change the destination page. Would it be better to use Server.Transfer or Server.TransferRequest instead of Response.Redirect? There are other HTTP Modules in the solution, will I bypass any of the other modules by using Server.Transfer or will the server begin as though it is a new request, just saving the round trip to the browser? Will the client notice any differences and will the server

How to remove params from url codeigniter

廉价感情. 提交于 2019-12-18 09:02:50
问题 I have url like this : http://domain/sentencijos/autoriai/429/marselis-prustas , where sentencijos is a controller, autoriai is a method, 429(param) is marselis prustas ID. I want to remove this param (ID) but don't know how. Full url should look like this: http://domain/sentencijos/autoriai/marselis-prustas Can someone help me? Thanks 回答1: Replace slug with id in your URLs. This is how it works: 1) I'm assuming here a product website flow. 2) For a particular product page, displaying the