url-rewriting

Prettyfaces: Set a bean property to some constant value, on observing a specific url pattern

别等时光非礼了梦想. 提交于 2019-12-04 05:24:56
问题 While writing the URL mapping rules for Prettyfaces in pretty-config.xml I would like to add a rule that whenever a particular pattern is observed in URL then set a specific constant value to bean property. For e.g. when there is a pattern like ../products/electronics then it should set bean property bean.category to ELECTRONICS_ITEMS . How do I do that ? 回答1: You should simply use a path parameter and convert the value from the URL to your constant in a page action method. Something like

htaccess rewrite rule with regular expression

混江龙づ霸主 提交于 2019-12-04 05:15:06
问题 I have a hard time to create rewrite rule for a redirect using part of an old URL. Example: Old URL: http://www.example.com/news/index.php/2014/11/07/my-blog-post-from-old-site or http://www.example.com/news/index.php/2014/11/07/my_blog_post_from_old_site New URL: http://www.example.com/2014/11/07/my-blog-post New URL should to have only dates and first three elements of a permalink after stripping from dashes. Even I'm not sure if can be done using .htaccess rule but for sure can be done

Htacess Rewrite Rule - Doesn't work without Trailing Slash

隐身守侯 提交于 2019-12-04 05:08:20
问题 So I have the following Rewrite Rules: RewriteRule ^([a-z0-9_\-]+)(\.php)?$ index.php?page=$1 [NC,L,QSA] RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?shop=$1&page=index [NC,L,QSA] RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z_-]+).php$ index.php?shop=$1&page=$2 [NC,L,QSA] Everything seems to work great, if I go to domain.com/shop/ then it works fine and shows the index. If I go to domain.com/shop/about.php then it works perfect. The only thing that does not work is when I go to domain.com/shop without

IIS 7 Canonical URL redirect

丶灬走出姿态 提交于 2019-12-04 04:58:12
I would like to make a website always have www in the address, and enforce it via IIS rewrite. For example, test.com would become www.test.com. The typical example rewrite rule is: <rule name="Canonical Host Name" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" negate="true" pattern="^www\.test\.com$" /> </conditions> <action type="Redirect" url="http://www.test.com/{R:1}" redirectType="Permanent" /> </rule> However this requires me to enter the full url of my website. It will not work for development and staging environments that have URLs like www.test.dev

nginx rewrite: the symbol for ANY UTF8 character

最后都变了- 提交于 2019-12-04 04:27:40
问题 I want to know what symbol I can use to refer to any character within the utf8 encoding table for nginx rewriting. I have tried: rewrite ^/.$ /new-location.html break; but it seems the "." can only stand for ascii characters, when I tried http://example.com/汉 (a Chinese character), it did not work. This also does not work: rewrite ^/([\x00-\xff])$ /new-location.html break; 回答1: From the documentation : However, UTF-8 and Unicode support has to be explicitly enabled; it is not the default. The

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

一曲冷凌霜 提交于 2019-12-04 04:21:24
问题 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 回答1: 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

IIS Reverse Proxy to node.js

情到浓时终转凉″ 提交于 2019-12-04 04:20:21
问题 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

URL RewriteRule in .htaccess for index.php query parameters

早过忘川 提交于 2019-12-04 04:20:03
问题 Example URL's:- www.domain.com/index.php?bob www.domain.com/index.php?jane www.domain.com/index.php?fred Need rewriting like:- www.domain.com/bob www.domain.com/jane www.domain.com/fred Have tried with many variations now but the closest I can get to is:- www.domain.com/?bob www.domain.com/?jane www.domain.com/?fred The below in .htaccess achieves this... RewriteRule ^(.*)$ index.php?$1 [L,QSA] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC] RewriteRule ^ %1 [R=301,L] Please could

POST request getting converted to GET when URL rewriting is done in apache httpd

不羁的心 提交于 2019-12-04 03:26:54
问题 I have an apache web server that acts as a reverse proxy to internal app servers. I have used ProxyPass and ProxyPassReverse to achieve this. I have multiple context roots mapping to different applications. I am trying to remove the context root from the domain name for one context so that users can access the website directly as https://mydomain.com instead of https://mydomain.com/contextRoot. I have added the following rewrite rules instead of the proxypass and proxypassreverse

Request method 'POST' not supported

橙三吉。 提交于 2019-12-04 03:21:17
According to the Spring Documentation here : While HTTP defines these four methods, HTML only supports two: GET and POST. Fortunately, there are two possible workarounds: you can either use JavaScript to do your PUT or DELETE, or simply do a POST with the 'real' method as an additional parameter (modeled as a hidden input field in an HTML form). They have done the latter, and can be achieved with the following spring MVC form tag: <form:form method="delete"> <input type="submit" value="Delete"/> </form:form> The problem is when i click 'Delete' my page throws the following error: HTTP Status