rewrite

IIS7 URL Rewrite to redirect based on path

大兔子大兔子 提交于 2019-12-13 04:38:09
问题 Using IIS 7.5 and URL Rewrite 2.0, how would I redirect the following: https://main.mysite.com/help/2012/v1.2.3 to https://help.mysite.com/2012/v1.2.3 And the part of the path after help will not always be 2012, it could be any recent year. Same with the v1.2.3; it's a version number so it will change. Thank you. 回答1: This is a pretty common scenerio - here is a great article with lots of pictures that will help guide you through the process of creating a map for rewriting in IIS 7.5. http:/

htaccess rewrite multi domain

删除回忆录丶 提交于 2019-12-13 04:13:42
问题 i have a 2 domain website. Basically, the 2 domains are for my multilanguage visitors. What i need is to rewrite domain1.com/en/ to domain2.com , so that user will be able to see the english version of the site by just typeing the domain2.com in the address bar instead of domain1.com/en/ . Any tips? and btw: i'm using php / apache.. EDIT:both domains point to the same hosting account... tnx! 回答1: Add these lines to your .htaccess file in the root folder of your website. RewriteEngine On

htaccess remove subdirectory from url

为君一笑 提交于 2019-12-13 04:01:57
问题 I have read multiple threads based on this subject but none of the rules have worked so i'm sure i m doing something wrong. I have the following struncture in my /var/www main domain folders that redirects to domain.com folder1 that redirects to domain1.com folder2 that redirects to domain2.com Inside folder2 i have 3 more subdirectories folder2/subdirectory1 folder2/subdirectory2 folder2/subdirectory3 These should redirect to: www.domain2.com/subdirectory1 www.domain2.com/subdirectory2 www

Redirect in IIS using Variables ($1$2)

让人想犯罪 __ 提交于 2019-12-13 02:33:26
问题 Right now I have a redirect set up like this <rule name="EN" stopProcessing="true"> <match url="en/(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Redirect" url="$1$2" /> </rule> However, it is not working properly. I'm trying to get it to be so when a user types in www.mysite.com/en/anything.aspx That it redirects to www.mysite.com/anything.aspx I have a feeling I've set something up wrong, maybe incorrect syntax. Any help would be greatly

Need a specific URL RewriteRule in .htaccess

喜你入骨 提交于 2019-12-13 01:28:35
问题 I am new to setting up the .htaccess and I would appreciate some help in my problem. If the user hits the following URL (original URL): http://www.example.com/somepage/something I want it to redirect to: http://www.example.com/somepage AND keep the original URL in the browser. So far, I have the following: RewriteRule ^somepage/(.*)$ /somepage [R=301] But, it doesnt work. How do I get this working? EDIT: Here is what my .htaccess file looks like right now: # do not allow anyone else to read

why does my rewrite rule without redirect give a 500 error?

做~自己de王妃 提交于 2019-12-13 00:49:24
问题 i want to rewrite urls like mysite.com/eng?sentence=cat to show like: mysite.com/eng/cat I dont want a redirect just a rewrite. so I tried altering a rewrite rule i found, the example before i edited it had a R=301 in it originally: RewriteCond %{THE_REQUEST} ^GET\ /eng\?sentence=([^&\s]+) [NC] RewriteRule ^eng\?sentence=$ /english/%1? [R=302,NC,L] but when i remove the R=301 from the 2nd line it gives a 500 error. how can I write this kind of rewrite rule? Im not great with this regex stuff,

Apache rewrite for 404: getting the requested url

烂漫一生 提交于 2019-12-13 00:34:51
问题 On my error page that I redirect to for any 404s, I'd like to record the url that the user tried to get to. I've tried this but it doesn't work: ErrorDocument 404 /error/?url=%{HTTP_REFERRER} Can anyone tell me how to do it? 回答1: Try it with %{REQUEST_URI} . I'm not certain this will work in ErrorDocument since I've never tested it, but it's worth trying. ErrorDocument 404 /error/?url=%{REQUEST_URI} 回答2: There isn't a direct way. Nor a perfect one. But there are few workarounds with PHP. For

htaccess rewrite pass two variables or one depending if both are available?

微笑、不失礼 提交于 2019-12-12 15:25:00
问题 I want to pass first directory as a variable and subdirectory as another variable. It works when for urls with both directories (/something/something2) but I get an error 404 when I try with only one (/something). RewriteRule ([^/]+)/([^/]+) /posts/?category2=$1&category2=$2 [L,QSA] How can I pass only category1 when category2 isn't available? 回答1: Few solutions: Multiple rules (easier to understand but a bit slower): RewriteRule ^([^/]+) /posts/?category2=$1 [L,QSA] RewriteRule ^([^/]+)/([^/

rewrite subdomain url in nginx to backend-server

不打扰是莪最后的温柔 提交于 2019-12-12 09:19:00
问题 I'm running nginx in front of my django (gunicorn) app. I want calls made to: api.mydomain.com to be redirected to: localhost:8080/api I now have this, but this obviously doesn't work: server { listen 80; server_name api.mydomain.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; location / { index index.html index.htm; proxy_pass http://localhost:8080/api; } } Thanks! 回答1: You can

.htaccess to change the url path

耗尽温柔 提交于 2019-12-12 09:16:42
问题 I have tried several examples of solutions that I have found here on StackOverflow but none of them seem to work correctly. I have a Magento store that I need to redirect an old store code url to the new one. For example: The old url looked like this. www.example.com/something_en In the above example I need to be able to modify any url that contains to the path something_en and change it to something like in the next example. www.example.com/something Any help is much appreciated. 回答1: Make