url-rewriting

Multiple domains to single website

时光总嘲笑我的痴心妄想 提交于 2019-12-23 12:15:42
问题 I have multiple domains pointing at the same website. (FFFF.com, FFFF.ca, FFFF.org, etc) What's the best way to achieve a rewrite to FFFF.com all incoming traffic? URL rewrites or 301s? Looking for best practice. These two would be dealt with within htaccess right? Thanks, 回答1: You would want to do a 301 in this instance. In general, if you're trying to figure out which method is best practice, it's usually the choice that makes it clear to the client what is going on. Transparently re

.htaccess rewrite URL with a question mark “?” only for 1 specific URL

随声附和 提交于 2019-12-23 10:57:56
问题 I already started a topic some weeks ago. But I got now a new problem that is very similar to the old problem: .htaccess rewrite URL with a question mark "?" My aim was this URL: /mysite/component/users/?view=registration Rewrite into this new URL: mysite/registration.html My current .htaccess got this code: RewriteBase /mysite RewriteCond %{QUERY_STRING} ^view=(.*)$ RewriteRule ^component/users/?$ %1.html? [R=301,L] It worked very fine. But then I noticed that this config concerns all URL

How to remove a subdirectory from the url before passing to a script?

送分小仙女□ 提交于 2019-12-23 09:31:46
问题 This has been asked on SO before but the answers have not been generalized. So here goes. I have two different web apps. They were made to be on different servers at the root. But now they are going to be placed into subdirectories on the same server. The script below is sending the subdirectory along with the URI's to the scripts. This is a problem. old urls: http://store.example.com/items/1 http://backoffice.example.com/accounts/1234 new urls: http://www.example.com/store/items/1 http://www

Making PHP GET parameters look like directories

心已入冬 提交于 2019-12-23 09:09:28
问题 I am trying to make it so: http://foo.foo/?parameter=value "converts" to http://foo.foo/value Thanks. 回答1: Assuming you're running on Apache, this code in .htaccess works for me: RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]+)/$ /index.php?parameter=$1 Depending on your site structure you may have to ad a few rules though. 回答2: Enabling mod_rewrite on your Apache server and using .htaccess rules to redirect requests to a controller file. .htaccess # Enable rewrites RewriteEngine On # The

Rewriting a number based URL using .htaccess RewriteRule

﹥>﹥吖頭↗ 提交于 2019-12-23 08:50:03
问题 How can I rewrite a simple number based URL to a sub folder? I want http://mysite.com/123 to redirect to http://mysite.com/en/123. The number could be anything from 1 - 9999. My attempt in htaccess was: RewriteRule ^([0-9]+)$ /en/$1/ [R] But that doesn't work. 回答1: your syntax is right, I just remove slash in the end of line and it works: RewriteRule ^([0-9]+)$ /en/$1 回答2: Make sure that this 3 lines are writen in your HtAccess File (sorry for mybad english) Options +FollowSymlinks

IIS Rewrite Input Types

久未见 提交于 2019-12-23 07:07:35
问题 What are the input types you can use in IIS rewrite rules? The ones I mean are like as follows: <conditions> <add input="{HTTP_HOST}" type=”Pattern” pattern="^www\.mysite\.com$" negate="true"> </conditions> HTTP_HOST URL REQUEST_FILENAME ? 回答1: You can try the below input types. See also reference docs for the URL Rewrite module. CACHE_URL DOCUMENT_ROOT HTTP_URL HTTP_HOST PATH_INFO PATH_TRANSLATED QUERY_STRING REQUEST_FILENAME REQUEST_URI SCRIPT_FILENAME SCRIPT_NAME SCRIPT_TRANSLATED

Wordpress url rewriting - nice URL with name from SugarCRM

那年仲夏 提交于 2019-12-23 05:38:05
问题 I'm developing a Wordpress site, that loads most of the content from SugarCRM. Currently I get the boats item on URL like http://domain.com/boats/?id=123456789 but I would like to have nice URL's, with the name that is loaded from SugarCRM, like http://domain.com/boats/this-is-boat-name Is there a way to do this without creating custom post type and a post for each item in Wordpress? 回答1: You could try using add_rewrite_rule . Have the user access the page via the url domain.com/boats/12345

NGINX Rewrites dynamic pages

早过忘川 提交于 2019-12-23 04:26:22
问题 I need some help with nginx regex rewrites. THIS https://www.website.com/downloads.php?do=file&id=4798 TO https://www.website.com/index.php?resources/4798/ THIS https://www.website.com/showthread.php?t=4449128 TO https://www.website.com/index.php?threads/4449128/ THIS (TRICKY ONE). https://www.website.com/forumdisplay.php?f=12&prefixid=8 TO https://www.website.com/forums/pc-probs.12/?prefix_id=8 Thank you all for your help. @Miguel Mota Mark 回答1: Try this. This works based on your examples.

url rewrite for aspx page

浪子不回头ぞ 提交于 2019-12-23 04:15:17
问题 I have a page, called foo.aspx and i d like to rewrite the url as bar.something How to do this? How does url rewrite happens in asp.net Should i create a generic handler? or should i get some url rewrite modules and add to app? 回答1: This is done by configuring IIS, and will require IIS7, look here for configuration help: http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/ 回答2: Remember, you also have the new Routing option with ASP.NET 4.0: https://stackoverflow.com/questions

Rewrite both domain and path

心不动则不痛 提交于 2019-12-23 03:52:16
问题 I want to redirect one specific url like: www.example.com/test/ex.gif to static.example.com/ex.gif How can i do this in .htaccess? 回答1: From the top of my head: RewriteRule ^http://www.example.com/test/ex.gif$ http://static.example.com/ex.gif [NC,R=301] or to any file in test: RewriteRule ^http://www.example.com/test/(.*)$ http://static.example.com/$1 [NC,R=301] Corrected after advice from Mr. Berardi 回答2: Try this mod_rewrite rule: RewriteEngine on RewriteRule ^test/(.*) http://static