url-rewriting

Regex for URL rewrite with optional query string parameters

断了今生、忘了曾经 提交于 2020-01-04 10:43:08
问题 I have this rewrite rule: <rule name="rentals by proptype+state+city+street test" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{UNENCODED_URL}" pattern="^/([a-zA-Z0-9\-+]+)/rent/province/([a-zA-Z\-+]+)/street/([a-zA-Z0-9%\-+]+)/([0-9a-zA-Z%\-+']+)$" /> </conditions> <action type="Rewrite" url="search_new.aspx?proptype={C:1}&province={C:2}&city={C:3}&street={C:4}" appendQueryString="true" /> </rule> I also tried: <rule name="rentals by proptype+state+city+street test"

Mod Rewrite and passing a URL as parameter

廉价感情. 提交于 2020-01-04 09:26:23
问题 I am having a small trouble with mod rewrite. A friend of mine is writing a script that allows you to upload images. What we want to do is allow the user to append a domain name to a direct image link, and the script would retrieve the image from the supplied URL. For example, if the image is at: http://www.test.com/image.jpg, adding domain.com /http://www.test.com/image.jpg would allow a script to retrieve that url (test.com) to get the image we want. EDIT: HTTP is in front of the URL

Log of Apache rewrites

╄→гoц情女王★ 提交于 2020-01-04 05:26:53
问题 I'm getting a "webpage has a redirect loop" error. Most likely this is due to my Apache rewrite configuration. I've had these issues before, and find them hard to debug. Is there some sort of log that allows me to see what the request is being redirected to? If not, how do you debug Apache rewrites in an efficient way? 回答1: You can configure mod_rewrite's log file via the "RewriteLog" directive. For example: RewriteLog "/usr/local/var/apache/logs/rewrite.log" For more information, see: http:/

URL rewrite for Subdomain

一个人想着一个人 提交于 2020-01-04 05:18:28
问题 The situation is simple. I create a wildcard subdomain in my cpanel that goes something like this: *.mysite.com. I can load the page but I want to take the value of the wildcard as a parameter of GET so the page can actually display the relevant contents based on that GET value. So what i want to know is if its possible to have a rewrite rule that allows me to do the following. Get: $_GET['store']=='andystore' from the url: http://andystore.mysite.com 回答1: You can use this code in your

Mod_Rewrite setting subdomain and directory to GET variable

不想你离开。 提交于 2020-01-04 04:01:05
问题 I programmed a website that I want to be multilingual, the separate languages should be accessable via subdomain, for example en.example.com, de.example.com and so on. Furthermore I already have a rewrite to set a "directory" as GET variable, that changes example.com/name to example.com/index.php?page=name. No matter what I tried I find no possibilities to properly combine the two codes I need to use with these respective problems. Each in it's own works, I only need a method to combine both,

Simple IIS URL Rewrite

Deadly 提交于 2020-01-03 18:54:50
问题 Simple question. I need to redirect all http 80 and https 443 requests on a specific subdomain URL to an alternative SSL port https 444. Example: http://sub.corp.com --> https://sub.corp.com:444 Example: https://sub.corp.com --> https://sub.corp.com:444 I only wish to use IIS 7.5 URL Rewrite module. Thanks. 回答1: The following URL rewrite rule should do what you want: <rewrite> <rules> <rule name="Redirect to port 444" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping=

catching all invalid URLs

廉价感情. 提交于 2020-01-03 15:56:46
问题 I recently upgraded a site and almost all URLs have changed. I have redirected all of them (or so I hope) but it may be possible that some of them have slipped by me. Is there a way to somehow catch all invalid URLs and send the user to a certain page and somehow know what URL the person came from so I could log this, and fix those? I'm thinking I could use .htaccess somehow but am not sure how. I am using PHP Thanks so much! 回答1: You could use a custom ErrorDocument handler written in PHP to

.htaccess rewrite url - show html file as jpg

大憨熊 提交于 2020-01-03 05:58:11
问题 I have image.html and I want It to be shown in browser as image.jpg, because there are some operations when showing picture, that can't be done before or after. Is it even possible with .htaccess and url rewriting? I tried RewriteEngine On RewriteBase / RewriteRule ^image\.html$ image.jpg but without any luck. Thanks for all answers 回答1: First of all, you'll need let's say a PHP script. Call it image.php . After that, use a GET parameter to handle the image name. Let's call it name . To call

Removing .php from urls with lighttpd (clean urls)

一曲冷凌霜 提交于 2020-01-03 05:44:04
问题 I am migrating an over loaded server from apache2 to lighttpd, currently I am proxying all the static resources from the lighttpd server but that still doesn't fix the load problems. I want to migrate everything to lighttpd but I've run into a problem. Apache2 has multiviews functionality to clean up URLs which lighttpd doesn't. I found the following code to do it in lighttpd url.rewrite-if-not-file = ( "^([^?]*)(\?.*)?$" => "$1.php$2" ) It works but it has two problems 1: website.com/

UrlRewrite via appcmd

♀尐吖头ヾ 提交于 2020-01-03 05:28:08
问题 I want to create urlrewrite url using appcmd for redirecting all requests from http:// to https:// I tried to google but nothing found. Could you provide me some basic example? 回答1: Got it working with this: appcmd.exe set config -section:system.webServer/rewrite/rules /+"[name='http_redirect',enabled='True']" /commit:apphost appcmd.exe set config -section:system.webServer/rewrite/rules.[name='http_redirect'] /match.url:"(.*)" /match.ignoreCase:true /commit:apphost appcmd.exe set config