url-rewriting

URL Rewriting Help

早过忘川 提交于 2019-12-11 16:05:58
问题 I'm trying to learn Regex & URL Rewriting in PHP. How can I create an .htaccess file which will rewrite (not redirect) any url to index.php?q={url} ? For example: http://www.example.com/baloon to http://www.example.com/index.php?q=baloon I tried: RewriteEngine On RewriteRule ^$ index.php?q=$1 [R] ...but it is not working. What am I doing wrong? Thanks. 回答1: Rewriting ANY url to index.php?q=$1 would result in internal server error as it'd create an endless loop; instead do something like this:

Rewrite URL www.domain.com/ru_en/test/test to www.domain.com/ru/en/test/test

烂漫一生 提交于 2019-12-11 15:53:42
问题 I want to rewrite an url to an other by replacing the underscore _ with slash / in the case of detecting ru_ru or ru_en or cn_cn or cn_en I m using nginx and I want to use the rewrite to define the rule or the rewrite www.domain.com/ru_en/test/test to www.domain.com/ru/en/test/test www.domain.com/ru_ru/test/ to www.domain.com/ru/ru/test/ www.domain.com/cn_en/test/test to www.domain.com/cn/en/test/test www.domain.com/cn_cn/go to www.domain.com/cn/cn/go The redirect must be done without

IIS Url Rewrite rule HTTP to HTTPS AND add WWW

二次信任 提交于 2019-12-11 15:47:06
问题 I have a website that I want to be only used with the WWW sub-domain and via HTTPS. I had an URL rewrite working for adding WWW. But now I also want to force a HTTP to HTTPS redirect. Just forcing HTTPS works as well, but when I can't really figure out how to combine the 2. Can someone provide me with a working rule that redirects to https://www.domain.com in case the request is without WWW and/or via HTTP. 回答1: I have been made a question months ago like it and answers may help you. Look at:

IIS Rewrite Rule how to check requesturl + .php file is exists or not in rule

时光怂恿深爱的人放手 提交于 2019-12-11 15:47:01
问题 i want to check that file with requestedurl + .php is exists or not. in apache i can do this with RewriteCond %{REQUEST_FILENAME}.php -f so that it can rewrite my request test.com/login to test.com/login.php i want to do same with iis rewrite rule. i have tried with following. <rewrite> <rules> <rule name="Imported Rule 1" stopProcessing="true"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}\.php"

How to forward mydomain.com to mydomain.net web site

痴心易碎 提交于 2019-12-11 15:25:01
问题 "mydomain .com " is hosted on iis 7.5 and referenced at google, For the same website, I need to use a second domain name: "mydomain .net " . I would like to redirect people who type "mydomain.com" to "mydomain.net" without losing previous google referencing, please how can I do that ? Thanks in advance. 回答1: Within IIS it is necessary to duplicate the mydomain.net web site folder, and to link the duplicated web site to mydomain.com , then select mydomain.com and click on HTTP redirect (which

.htaccess to convert query string never works

Deadly 提交于 2019-12-11 14:23:24
问题 The goal: To have a query string converted into a nice looking URL, which I have never gotten to work. The details: Change this URL: http://www.mywebsite.com/static-directory/index.php?state=florida&city=tallahassee to this one: http://www.mywebsite.com/static-directory/florida/tallahassee What I have tried: Well, just about everything. My latest search came up with this tutorial... I have my .htaccess file in my root directory (httpdocs). Any help or point me at the right answered question

htaccess redirect for www to non-www not working

懵懂的女人 提交于 2019-12-11 13:45:58
问题 This is driving me bananas. For some reason my domain will not work to redirect https-WWW to https-non-WWW. This works with every other permutation except https://www.nextoronto.com What code do I use in the .htaccess that will allow it to work for all permutations? Edit: This is the rewrite code now: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.nextoronto\.com [NC] RewriteRule ^(.*)$ https://nextoronto.com/$1 [L,R=301] 回答1: It looks sound, perhaps that rule isn't being reached due to

URL Rewrite troubleshoot

我与影子孤独终老i 提交于 2019-12-11 13:43:13
问题 We have our URL rewrite as followed. I tested the pattern in IIS 8.5 URL Rewrite and the patterns matched as what we wanted. However, it's 404 every single time. Will someone take a look and see what is wrong with my URL rewrite? Thank you. URL: devbox.mysite.com/article/how-to-use-onedrive Pattern: (.*)/article/(.*)$ Action Rewrite URL: {R:1}/article/?artID={R:2} Currently the page shows 404. Below is the XML code in web.config file. <rule name="Article-rewrite" enabled="true"> <match url="(

Why would mod_rewrite rewrite twice?

一世执手 提交于 2019-12-11 13:41:46
问题 I only recently found out about URL rewriting, so I've still got a lot to learn. While following the Easy Mod Rewrite tutorial, the results of one of their examples is really confusing me. RewriteBase / RewriteRule (.*) index.php?page=$1 [QSA,L] Rewrites /home as /index.php?page=index.php&page=home . I thought the duplicates might have had been caused by something in my host's configs, but a clean install of XAMPP does the same. So, does anyone know why this seems to parse twice? And, to me

htaccess rewriterule and directoryindex

穿精又带淫゛_ 提交于 2019-12-11 13:39:29
问题 I'm having issues with my rewriterule and directory index DirectoryIndex invite.php about.php account.php RewriteRule ^/?([a-z0-9_-]+)/?$ /user.php?u=$1 [L] Lets say about.php is in the about folder. When i go to www.url.com/about/about.php, it works fine. But when I go to www.url.com/about/ , it goes to my user.php page. When I go to www.url.com/about , (without ending slash), it goes to www.url/about/?u=about Can anyone help me? At the same time, I'm trying to set up where user can go to