url-rewriting

Nginx rewrite non-www-prefixed domain to www-prefixed domain

守給你的承諾、 提交于 2019-12-03 01:38:11
问题 I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain to a non-www-prefixed domain: if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo' } How can I do the reverse-- rewrite a non-www-prefixed domain to a www-prefixed domain? I thought maybe I could do something like the following but Nginx doesn't like the nested if statement. if ($host !~* ^www\.) {

Force some pages over HTTPS and others to HTTP… is it possible?

自闭症网瘾萝莉.ら 提交于 2019-12-03 00:45:44
I'm really stuck on this one... Basically, I'm trying to make 2 pages always over SSL using the URLRewrite add-on for IIS. But I also need to force all other pages to HTTP (sigh - don't ask). But if I force other pages over HTTP, then when you view the SSL page you'll get the security warning. I tried to solve this by checking if the HTTP_REFERER is the SSL page then let it be sent over SSL for that page only. This doesn't work because if someone clicks a link on the SSL page then it will stay over SSL. Is this even possible?... This is as far as I got so far: <rewrite> <rules> <rule name=

php/symfony2 hiding app.php from the URL

倾然丶 夕夏残阳落幕 提交于 2019-12-03 00:32:29
Consider the following URL : http://www.myurl.fr/accueil . It won't work. However http://www.myrurl.fr/app.php/accueil does work. I got rid of the .htaccess file because I want to use the vhost file and rely on Apache routing. My vhost file is as follow: <VirtualHost my.ip.address> ServerName myurl.fr ServerAlias www.myurl.fr DocumentRoot /var/www/mysite/web DirectoryIndex app.php <Directory "/var/www/mysite/web"> AllowOverride All Allow from All </Directory> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R

What's the difference between Request.Url.Query and Request.QueryString?

▼魔方 西西 提交于 2019-12-02 23:24:05
I have been tracking down a bug on a Url Rewriting application. The bug showed up as an encoding problem on some diacritic characters in the querystring. Basically, the problem was that a request which was basically /search.aspx?search=heřmánek was getting rewritten with a querystring of "search=he%c5%99m%c3%a1nek" The correct value (using some different, working code) was a rewrite of the querystring as "search=he%u0159m%u00e1nek" Note the difference between the two strings. However, if you post both you'll see that the Url Encoding reproduces the same string. It's not until you use the

What Url rewriter do you use for ASP.Net? [closed]

試著忘記壹切 提交于 2019-12-02 23:14:30
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why. Here are the ones that I have used or looked at: ThunderMain URLRewriter : used in a previous project, didn't quite have the flexibility/performance

pretty url with .htaccess?

对着背影说爱祢 提交于 2019-12-02 22:41:25
问题 i just created a new wordpress page template that runs some php&mysql scripts inside it and i would like to apply mod rewrite to it's subpages. for instance i have the following link generated: http://www.quotist.com/quotes-by-authors.html?letter=D how can i transform this into something like: http://www.quotist.com/quotes-by-authors/letter/d/ ? in my htaccess i have the default code generated by wordpress ... does anyone know how to achieve that? 回答1: Try this: Options +FollowSymLinks

UrlRewriteFilter: remove parameters

☆樱花仙子☆ 提交于 2019-12-02 22:22:40
问题 I have a URL like example.com/sample.html?h=22&w=23 How can use UrlRewriteFilter to remove the params from this URL and redirect the request with the URL example.com/sample.html? I need to remove the params because my application (hosted on Tomcat) does not handle these. 回答1: <urlrewrite> <rule> <note>Forward calls from sample.html to sample.html with no query_string</note> <from>^/sample.html$</from> <to type="redirect" last="true">/sample.html</to> </rule> <urlrewrite> you might want to use

Forcing non-www url in Wordpress installation causes infinite loop

冷暖自知 提交于 2019-12-02 21:22:23
问题 I am trying to rewrite http://www.domain to http://domain in a wordpress installation, but it looks like it's making the url loop from http://www to http:// and back to http://www, etc. This is my htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] <

IIS7, RewritePath and IIS log files

笑着哭i 提交于 2019-12-02 21:03:32
I am using Context.RewritePath() in ASP.NET 3.5 application running on IIS7. I am doing it in application BeginRequest event and everything works file. Requests for /sports are correctly rewritten to default.aspx?id=1, and so on. The problem is that in my IIS log I see GET requests for /Default.aspx?id=1 and not for /sports. This kind of code worked perfectly under IIS6. Using Microsoft Rewrite module is not an option, due to some business logic which has to be implemented. Thanks. EDIT: It seems my handler is too early in the pipeline, but if I move the logic to a later event, than the whole

Rewrite rule for subdomains

邮差的信 提交于 2019-12-02 20:15:20
问题 Is it possible to use .htaccess for a subdomain to point to a file on the main domain? I have example.com as a main domain and created subdomains: one.example.com, two.example.com, etc through DirectAdmin. The subdomains should point to app.php on the main domain but in the url the subdomain should persist. So navigating to one.example.com should be pointing to app.php which lives in the main domain example.com, but the url should still show one.example.com I have looked and tried a lot of