url-rewriting

Url rewrite does not install on windows 10 IIS 10

放肆的年华 提交于 2019-12-02 20:01:03
I need the Url Rewrite module on my IIS But it does not install and says that I need at least IIS7 the newer version supports win10 out of the box: https://www.microsoft.com/en-us/download/details.aspx?id=47337 Boas Enkler Because it took me hours to find the problem, I am posting this solution to my own answer so it will save someone else this work. In short you have to change the major version of the IIS via the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\MajorVersion to 9 during installation and then back to 10 afterwards. Solution is from: https://forums.iis.net/t/1223556

Best way to format pretty URLs for numeric IDs

人走茶凉 提交于 2019-12-02 19:44:59
Alright, so let's say I'm writing a forum application, and I want pretty URLs. However, all my tables use numeric IDs, so I'm not sure the best way to format the URLs for those resources. Let's pretend I'm trying to get a topic with ID 123456 and title This is a forum post . I've seen it done a couple ways: www.example.com/topic/123456 www.example.com/topic/this-is-a-forum-post www.example.com/topic/123456/this-is-a-forum-post Which one would you say is, taking all things into consideration (including SEO), the optimal URL? Sorry if this question is too vague, but it seems programming-related

How to execute a PHP web page without the .php extension in the URL?

狂风中的少年 提交于 2019-12-02 19:18:05
Sorry for noob question, can't understand from what I should search. I'm making a site with that page product.php?id=777 I'd like it to be product/777 Thank you! Create .htaccess file in your web root and enter following there: Options +FollowSymLinks RewriteEngine on RewriteRule ^product/([0-9]+)$ product.php?id=$1 Instead of using mod_rewrite you can also use following in your .htaccess: DefaultType application/x-httpd-php And just name your script product on the server (without .php file extension). So you can invoke it directly and would receive any appended string as $_SERVER["PATH_INFO"]

Issue saving message to json file discord.py rewrite

淺唱寂寞╮ 提交于 2019-12-02 18:35:55
问题 I am attempting to save the most recent message of every user to a JSON file attached to their user ID. Something will be written to the file but it's not the raw message. async def on_message(self, msg): if msg.author == self.client.user: return with open("users.json") as f: users = json.load(f) users[str(msg.author.id)]['response'] = str(msg) with open('users.json', 'w') as f: json.dump(users, f) I expect the output to be the raw message of what the user sends but instead I get something

IIS 7.5 URL Redirect for specific patterns

南楼画角 提交于 2019-12-02 18:17:19
问题 When user enters domain.com it should redirect to my application which is https://www.domain.com. Currently it is not happening and it is showing a page "This Connection is Untrusted." I have following rewrite tag added in my web.config: <rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" /> </rule> </rules>

301 redirect not working in IIS 7

一世执手 提交于 2019-12-02 17:54:08
问题 I need to create this 301 redirect rule: /blog/item.asp?n=12817 redirect to /blog/item/12817 I created a rule in IIS URL Rewrite module with these parameters : Pattern: ^blog/item.asp\?n=([0-9]+) redirect url: blog/item/{R:1} When I test it in IIS it works fine and it created this rule in my web.config: <rule name="Asp classic Legacy 301 redirect" stopProcessing="true"> <match url="^blog/item.asp\?n=([0-9]+)" /> <action type="Redirect" url="blog/item/{R:1}" appendQueryString="true" /> </rule>

Changing URL parameters with routing in MVC 4

安稳与你 提交于 2019-12-02 17:45:26
问题 Several of my API functions allow parameters called 'attribute' and 'attributeDelimiter' (in singular), meaning the expected URL would be in the format of SomeController/SomeAction?aaa=bbb&attribute=ccc&attributeDelimiter=ddd. I would like to allow support for plural in those param names as well - 'attributes' and 'attributesDelimiter'. Is there a way to re-write the url in the RouteConfig? (turning the plural names to singular) If that is not possible or it wouldn't be the best practice,

Rewrite mysite.com/app.php?appname=example-name&appid=numeric-id to mysite.com/app/app-name/numeric-id/

时光怂恿深爱的人放手 提交于 2019-12-02 17:28:18
问题 I am new to PHP and server-side operations so asking this basic question here. I found a lot of similar questions and answers here but I fail to achieve what I want. How can I write my htaccess file to produce these results? Dynamic URL: mysite.com/app.php?appname=example-name&appid=numeric-id URL I want: mysite.com/app/example-name/numeric-id 回答1: Try this in your .htaccess file RewriteEngine On RewriteRule ^app/(.*)/(.*)/?$ /app.php?appname=$1&appid=$2 [QSA,NC,L] EDIT : RewriteEngine On

url having #! How is it useful For example facebook has http://www.facebook.com/#!

我的梦境 提交于 2019-12-02 15:45:10
问题 I see some time url has #! combination. What is the purpose of that ? & How it is useful. Can somebody elobrate on that. 回答1: After the hash mark ("#") it is expected the ID of some X/HTML element in the page that has to be highlighted or scrolled to by the user agent. Valid HTML ID attributes cannot contain "!", so it is more or less guaranteed that whatever follows "#" here will not match any element in the page. This trick is used to have many different URLs to the same page, and let a

How to implement the returnurl like SO in PHP?

左心房为你撑大大i 提交于 2019-12-02 15:23:37
问题 It should also work after url rewriting. Is it possible?Otherwise I can only hardcode everything. 回答1: If you are trying to create a login system with redirection you need to use the HTTP_REFERER header to find out where the user came from so you can send him back there. The best way to do this is, in your login form use something like this: //- Login.php <?php if ($_POST['username'] && $_POST['password']) { //- Run username and password verifying script header("Location: ".$_POST['returnurl'