url-rewriting

Regex to extract a part out of a URL and use it as a reference in url rewrite

戏子无情 提交于 2019-12-06 09:39:08
OK, I'm wondering if someone can lend a hand with a regex I'm trying to write. Basically, what I want to do is use IIS urlrewrite module to do a redirect to a specific URL if the user accesses a URL on another site. The only catch is I have to also capture a bit of the query string, and move it into the redirect. I think I actually DO have the regex correct for this, but it's implementing it in my web.config that is causing the problem. so here is the input, the URL that a user may access would look like: https://of.example.com/sfsv3.aspx?waform=pro&language=en I want to match that URL (either

301 Redirect where 2 domains point to same IP?

老子叫甜甜 提交于 2019-12-06 09:34:47
I have 2 TLDs example.com and example.ie . example.com and example.ie both point at the same IP address and pull the same content now we could get whacked with a ban hammer from Google for duplicate content so we want anyone accessing *.example.ie and *.example.com to be redirected to www.example.com the problem is as they are both pointing at the same server the .htaccess is the same thus I don't believe we can do the usual: Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^example.com [nc] rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc] So how do we go about creating

Rewrite Rule to Rewrite All EXCEPT File Extension

谁说我不能喝 提交于 2019-12-06 09:27:07
I've got a rule setup to rewrite everything going into a subdirectory like so: <rule name="Forms Directory" stopProcessing="true"> <match url="^forms/(.*)" /> <action type="Redirect" url="forms.htm" redirectType="Permanent" /> </rule> However, I want to make a slight change to allow it to access an ASP file in the forms folder. So I want to keep the same rule but exclude any .asp from matching the rule. I tried the following but couldn't get it to operate as expected: <rule name="Forms Directory" stopProcessing="true"> <match url="^forms/(.*)[^(.asp)]" /> <action type="Redirect" url="forms.htm

Are non-english characters 100% supported in codeigniter urls by default?

血红的双手。 提交于 2019-12-06 09:23:33
问题 I want to be sure if this behavior is 100% supported in CodeIgniter. What doubts me is that in config.php the permitted_uri_chars is as followed: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; It says that only English chars are allowed. BUT consider the results of following urls: http://localhost/codeigniter/index.php/controller/method/hell0-there+++ Result: The URI you submitted has disallowed characters. http://localhost/codeigniter/index.php/controller/method/hello-سلام Result: No

.htaccess redirect folder

﹥>﹥吖頭↗ 提交于 2019-12-06 09:20:08
All, I want to redirect all traffic that comes to http://mysite/ to http://mysite/public folder. Currently I am doing this using the below in an .htaccess file and it works for the root directory. But if I browse to http://mysite/application , it doesn't redirect and shows the directory listing. I want all traffic regardless of what folder it is to redirect to http://mysite/public folder RedirectMatch permanent ^/*$ /public/ Thanks Try this mod_rewrite example: RewriteEngine on RewriteRule !^public/ /public%{REQUEST_URI} [L,R=301] I see that you're using Zend Framework. Zend uses 'public' as

Ember/Ember-Cli Serving through Apache throws 404

随声附和 提交于 2019-12-06 08:17:49
问题 I'm running into a problem when I try to serve my ember app through Apache. Because the location is set to "history" and not "hash", Apache is trying to load the magic ember routes which don't exist as files. myapp.com/login throws a 404 because there is no login.html. I've done a bit of scouring and its surprising that there isn't much on this which leads me to believe that not many people deploy ember apps on apache. So it's suggested I write Apache URL Rewrite rules, but the one's I have

Catch-all URL rewrite on Google App Engine (Java)

耗尽温柔 提交于 2019-12-06 07:57:41
I'm trying to create a short URL for a GAE app, so I used UrlRewriteFilter , but I can't get it set up correctly. Basically, the user is given this: test.com/012a-bc and the page that they should be redirected to is test.com/vote.jsp?id=012a-bc At the moment it's working with the urlrewrite.xml file like this: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd"> <urlrewrite> <rule> <from>/([0-z]+)</from> <to last="true">/vote.jsp?id=$1</to> </rule> </urlrewrite> The problem is that all

Redirect to URL with POST method in Asp.Net Core

筅森魡賤 提交于 2019-12-06 07:49:28
问题 I have simple url rewriter: private static void RedirectToAPI(RewriteContext context) { var request = context.HttpContext.Request; if (request.Path.Value.StartsWith("/apiendpoint", StringComparison.OrdinalIgnoreCase)) { var json = JsonConvert.SerializeObject(request.Path.Value .Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries) .Skip(1)); var response = context.HttpContext.Response; response.Headers[HeaderNames.Location] = $"/custom"; response.StatusCode = StatusCodes

Flight PHP Routing from Subdirectory

一曲冷凌霜 提交于 2019-12-06 06:57:17
问题 So I'm using the Flight PHP microframework (http://flightphp.com/) to do routing. My question is, how can I run the router from within a subdirectory? What I mean is, essentially, run it 'sandboxed' within a folder. As in, a request to '/' just pulls the regular index.php file. But a request to '/flight/file' would load the URL using Flight. I know you can't just dump it in a folder on the server and expect it to work because FlightPHP expects the URLs relative to the root. Is there a way to

Clean URLs using jsp/ servlets?

放肆的年华 提交于 2019-12-06 06:33:29
问题 I am planning to make a CMS using jsp and servlets. Could anyone tell me how to implement clean urls using this technologies? 回答1: You could try using urlrewritefilter: http://code.google.com/p/urlrewritefilter/. This uses a servlet filter and an xml-file to allow your application to have clean url's. The construction of the clean url's would be your own responsibility. 回答2: Make use of HttpServletRequest#getPathInfo() in the servlet which is acting as front controller. Kickoff example