url-rewriting

IIS7 URL Rerwrite - how to replace all underscores with hyphens in a Regex?

大城市里の小女人 提交于 2019-12-10 19:48:34
问题 I am using the URL Rewrite feature in IIS7 to turn the URL: /main.asp?category=Name_Of_A_Product Into: /category/name-of-a-product/ I have created the redirect & rewrite rules below which do the majority of the work, except I cannot find a way of replacing the underscores with hyphens. Each URL can have between zero and many underscores and I'm trying to replace them in a single regular expression, to avoid chains of 301 redirects (as I believe that is bad for SEO). Do you know how (or if)

Tomcat URL Rewrite Filter isn't forwarding

烂漫一生 提交于 2019-12-10 19:42:45
问题 I'd like to forward all URLs matching the pattern: http://localhost:8080/docs/view.php?fDocumentId=([0-9]+) to: http://localhost:8080/alfresco/service/org/docs/redirect/document/properties/$1 This is on tomcat, and there are two primary webapps being loaded: "docs" & "alfresco". For simplicity sake, our old legacy application (LAMP based) had all URLS with /docs as the first part of the path, same as the new application. The reason I am forwarding to /alfresco is because of a webscript that I

How to get the “originally requested” URL when using IIRF URL Rewriting Engine

这一生的挚爱 提交于 2019-12-10 19:35:29
问题 I am using Iconic's IIRF URL Rewriting Engine on IIS and the "fancy" URLs are something like this: http://some-website.com/some-function/418/some-keyword-rich-filename.html This example URL corresponds to: http://some-website.com/some-function.asp?SOME-ID=418 Now inside the some-function.asp file I need to know the page that was requested by the browser. I went through all IIS variables but wasn't able to find the value /some-function/418/some-keyword-rich-filename.html inside any of them. As

Rewrite rule for Apache not finding URL?

依然范特西╮ 提交于 2019-12-10 18:58:05
问题 Using the answer I received from rcs20 in my previous post when I add this entry to my .htaccess file I see the error 404 Not Found: Options +FollowSymLinks RewriteEngine on RewriteRule ^member\-([0-9]+)\-([^/])\.htm(l)?$ view_profile.php?id=$1 [NC,L] The URL I'm passing it is: mysite/member-8222-jane.html Any idea why this might be happening. My old rewrite rule works fine: RewriteRule view_profile=(.*)$ view_profile.php?id=$1 回答1: found it: The + sign needs to be added to [^/] => ([^/]+)

how to url-safe encode a string with python? and urllib.quote is wrong

二次信任 提交于 2019-12-10 18:49:35
问题 Hello i was wondering if you know any other way to encode a string to a url-safe, because urllib.quote is doing it wrong, the output is different than expected: If i try urllib.quote('á') i get '%C3%A1' But thats not the correct output, it should be %E1 As demostrated by the tool provided here this site And this is not me being difficult, the incorrect output of quote is preventing the browser to found resources, if i try urllib.quote('\images\á\some file.jpg') And then i try with the

nginx location regexp for query string

ⅰ亾dé卋堺 提交于 2019-12-10 18:19:45
问题 I want to redirect anything that comes directly to my server with perticuler query string to other location in same domain. If user comes to http://www.mydomain.com/?abc=js9sd70s I want to redirect it to http://www.mydomain.com/otherpath/?abc=js9sd70s the query string ?abc=js9sd70s should be the same to new url. Please suggest nginx config file. I have tried most of the alternative for below code. by keeping '\' before ? and = sign. location ~ /?abc=.* { rewrite ^/(.*)$ http://www.mydomain

ASP.NET MVC Routing strategy for static content for each View

大兔子大兔子 提交于 2019-12-10 17:46:32
问题 I'm wanting for every view in my system to have some static help content. The way I was thinking about doing this would be to set up a parallel structure for the static content and create a route to rewrite the URL to this. For instance: /Controllers /Help /Account /Login.htm /Create.htm /Models /Views /Account /Login.aspx /Create.aspx ...where an incoming URL for " /Account/Create/Help " would serve " /Help/Account/Create.htm ". How can I add that to Global.asax:RegisterRoutes

.htaccess rewrite condition trailing slash only for specific directories

◇◆丶佛笑我妖孽 提交于 2019-12-10 17:32:21
问题 I have this rule which works great and adds a trailing slash for every directory on my site. How Can I add trailing slashes for only certain directories such /courses/ ? I don't want every directory / path to have a trailing slash. RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L] 回答1: RewriteCond %{REQUEST_URI} ^/(courses|foo|bar)$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L] Should work where courses , foo and bar are directories that you

URL Rewrite .htaccess

谁都会走 提交于 2019-12-10 17:10:03
问题 I'm getting ready to develop a web site with the following url structure. I'm a newbie to url rewrites and would like to know the best way to handle this. http://domain.com index.php http://domain.com/about about.php http://domain.com/agencies agencies.php http://domain.com/contact contact.php http://domain.com/publisher publisher.php http://domain.com/publisher/sign_up publisher_signup.php http://domain.com/agencies/sign_up agencies_signup.php http://domain.com/agencies/login login.php http:

Rewrite URL : remove sub folders and file extension from URL

丶灬走出姿态 提交于 2019-12-10 16:12:30
问题 I am trying to remove .php file extension and folder && subfolder from URL if they exist. Case 1 Input: 127.0.0.1/project/folder/alfa.php output: 127.0.0.1/project/alfa Case 2 Input: 127.0.0.1/project/folder/subfolder/beta.php Output: 127.0.0.1/project/beta Here is what I have got so far : Removing just extension works fine, having problem with removing folders # Turn mod_rewrite on RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^((?!