url-rewriting

How do I generically implement URL-rewriting in a MapRoute method?

為{幸葍}努か 提交于 2019-12-02 00:09:26
I am attempting to rewrite URL's from C#'s Pascal-case to SEO-friendly format. For example, I want something like /User/Home/MyJumbledPageName to look like this: /user/home/my-jumbled-page-name // lower-case, and words separated by dashes Here is my method for converting each "token" in the URL: public static string GetSEOFriendlyToken(string token) { StringBuilder str = new StringBuilder(); for (int i = 0, len = token.Length; i < len; i++) { if (i == 0) { // setting the first capital char to lower-case: str.Append(Char.ToLower(token[i])); } else if (Char.IsUpper(token[i])) { // setting any

Angular slash gets encoded

半世苍凉 提交于 2019-12-02 00:07:00
问题 Im having the same issue as this guy: angularjs-slash-after-hashbang-gets-encoded The URL gets encoded an it isn´t routed correctly, it appears to fal to the otherwise in my route config. No luck yet finding the reason, my URL rewriting is working fine. Hte only exception is when I add hashbang in the URL while in HTML5 mode. I expected to fallback to hashbang and rewrite the URL to html5 mode. Anyone knows what is happening here? Update: I will elaborate on the information provided

.htaccess url rewrite with variables

北城余情 提交于 2019-12-01 23:09:20
问题 I'm trying to make my urls look prettier in a specific subdirectory on my site by using rewrite to change: www.example.com/sub/file/{some_number}/ internally to: www.example.com/sub/file.php?var={some_number} And I keep getting a 404. I'm already removing the .php extension from my site using an .htaccess file that looks like this: RewriteEngine on # ## Internally rewrite extensionless file requests to .php files ## # # If the requested URI does not contain a period in the final path-part

Removing index.php from website URLs

喜欢而已 提交于 2019-12-01 22:45:44
问题 I am using the Kohana framework (but I think it's irrelevant for this question) and pages can be accessed like so http://www.example.com/articles/ http://www.example.com/index.php/articles/ Now, as a rule of thumb, I generally try and tweak my .htaccess to only allow one way in for a page, and silently redirect other common ways. Essentially, in the 1st URL above, the address is actually internally redirected to the 2nd example. What I want to do, is to force any URLs of the 2nd type to turn

.php url to .html url

南笙酒味 提交于 2019-12-01 21:49:10
I have a website built in .php but we have converted it to .html by using "mod rewrite" . the mod rewrite code used in .htaccess is RewriteEngine on RewriteRule ^(.*)\.html$ $1.php Now the problem is my website shows up in both .php and .html . for example: www.mydomain.com/index.html and also www.mydomain.com/index.php . as per my knowledge its not good for seo purpose and also it may fall in duplicate content to search engines. so i want to keep only .html [not .php] url live on search engines and for users. how to do that? UPDATE incoorperated comments (thanks guys) add another rewrite rule

IIS Reverse Proxy to node.js

假装没事ソ 提交于 2019-12-01 21:23:13
I am trying to configure a reverse proxy so that HTTP calls made from a website hosted in the IIS to node.js applications work. I'll explain it better: I've hired a VPS. In this VPS i have a IIS website (simple HTMl + Javascript ) and a node.js application running on localhost:3000. In javascript i make HHTP GET calls to the node.js to obtain some data. I need to configure a reverse proxy so that the HTTP calls made to node.mydomain.com for example, are internally redirected to localhost:3000. Example of website's HTTP call: $.get( "node.mymydomain.com/balance", function( data ) { alert( data

Rewriting path for a specific file using htaccess

眉间皱痕 提交于 2019-12-01 20:38:34
问题 I would like to create a friendly url for a specific file from a directory that has a long file path as well as renaming the file. I am not even sure if this is possible. So far I have tried in htaccess: RewriteEngine On Options +FollowSymLinks RewriteRule eventdays-2012/brochure.pdf(.+)$ sites/default/files/docs/fact_sheet-204499207.pdf ... but this is not working. I've done some searching and see where you can mask an entire directory in the file path but in my case I just want to do one

.htaccess url rewrite with variables

半世苍凉 提交于 2019-12-01 20:33:17
I'm trying to make my urls look prettier in a specific subdirectory on my site by using rewrite to change: www.example.com/sub/file/{some_number}/ internally to: www.example.com/sub/file.php?var={some_number} And I keep getting a 404. I'm already removing the .php extension from my site using an .htaccess file that looks like this: RewriteEngine on # ## Internally rewrite extensionless file requests to .php files ## # # If the requested URI does not contain a period in the final path-part RewriteCond %{REQUEST_URI} !(\.[^./]+)$ # and if it does not exist as a directory RewriteCond %{REQUEST

IIS 7 URL Rewrite doesn't work if the url has a question mark in it

眉间皱痕 提交于 2019-12-01 20:25:21
I'm using the URL rewrite feature of IIS7 I'm trying redirect a URL like this example.com/?parameter=abc to a URL like this example.com/somedirectory the URL redirect works well if the source URL doesn't contain a question mark in it. pls help -Vivek IIS7 redirects don't by default match query strings in the pattern so you have to add a condition as well as the pattern with {QUERY_STRING} matches the pattern parameter=abc 来源: https://stackoverflow.com/questions/2162946/iis-7-url-rewrite-doesnt-work-if-the-url-has-a-question-mark-in-it

Redirect URLs with FQDN (dot after TLD) to equivalent with PQDN

眉间皱痕 提交于 2019-12-01 20:24:06
Many websites can be accessed with a FQDN (i.e., appending a dot to the TLD): https://www.ebay.com./ https://www.google.com./ https://www.reddit.com./ https://stackoverflow.com./ https://en.wikipedia.org./wiki/Main_Page Some sites can’t be accessed that way, but I can’t find an example right now.¹ ² Is it possible, within a .htaccess file, to redirect all variants with the dot suffix to the variants without? Ideally with a "wildcard" rule, so that you don’t have to list the domains explicitly (for using it on different sites/domains without editing). Example redirects: http://example.com./ →