mod-rewrite

Multiple domains for site subsections

邮差的信 提交于 2019-12-12 04:12:35
问题 Here's the deal. Basically I've got multiple domains, and I would like one of the domains to point to the regular base of the site, but the other domains to point to a subsection of the site without modifying the url in the address bar. The idea is that each of the extra domains are branded for their section. Example: www.domain.com Top level of site www.domain2.com points to www.domain.com/abc www.domain3.com points to www.domain.com/def etc. Also note that in the example 'abc' and 'def' are

Regular Expression For URL Query

蹲街弑〆低调 提交于 2019-12-12 04:12:21
问题 I've been using mod_rewrite in my htaccess file to rewrite my urls and I've run into a problem when doing pagination. Here's the url for my page: http://domain.com/concerts/features/folk-roots?page=2 htaccess file: RewriteRule ^features/([^/]*)?page=([0-9]*)$ featureCat.php?cat=$1&page=$2 [NC,L] It works fine without the page query, but if I want to change pages I can't figure out how to write the regular expression to grab the page #. Any ideas would be appreciated! 回答1: You need to use

My mod_rewrite code in htaccess caused the page to not load

跟風遠走 提交于 2019-12-12 04:04:28
问题 I have horrible URLs like this: http://example.com/subfolder/index.php?a=1&b=1&token=8d519decbe60db44154b1fbc8c553ac4 I am trying to make it look like this: http://example.com/subfolder/menu/1/1/#/ But this code is causing the page to crash/not be found or something: RewriteEngine on RewriteCond %{QUERY_STRING} ^a=([0-9]+)&b=([0-9]+)&token=([A-Za-z0-9]+) RewriteRule ^subfolder/index.php /menu/$1/$2/#? [R=301,L] I put this .htaccess file in my root folder example.com/.htaccess , do I need to

Redirect old page url after .htaccess url rewriting

三世轮回 提交于 2019-12-12 04:03:31
问题 I have rewrited my url's with htaccess and now I want to redirect the old url's to the new ones, but I can't figure it out how to do it after all. This is my redirect rule used: RewriteRule ^page/([^/]*)/$ /page.php?name=$1 [L] The old url's look like this: page.php?name=page-name The new url's look like this: /page/page-name/ 回答1: That's a bit complex when you want redirect an url with GET parameters. Here's a trick to do it : RewriteRule ^page\.php$ %{QUERY_STRING} [C] RewriteRule name=(.*)

Rewrite rules for WordPress

*爱你&永不变心* 提交于 2019-12-12 03:58:51
问题 I have a custom page on my theme that displays differently based on given parameters. This page is set as homepage for the website. Valid parameters combinations can be as follows: my_domain/?fa={action}&type={type} my_domain/?fa={action}&id={type} my_domain/?fa={action} What i'm trying to do is to convert these links to the following: my_domain/fa/{action}/type/{type} my_domain//fa/{action}/id/{type} my_domain/fa/{action} My .htaccess file now looks like this, but it doesn't seem to work:

Why does mod_rewrite ignore my [L] flag?

╄→尐↘猪︶ㄣ 提交于 2019-12-12 03:58:43
问题 This is my .htaccess file. It should deliver static files from assets folder if the url matches them. Otherwise, everything should be redirected to index.php . Note that the url doesn't contain assets as segemnt here. So example.com/css/style.css directs to assets/css/style.css . RewriteEngine on # disable directory browsing Options -Indexes # static assets RewriteCond %{DOCUMENT_ROOT}/assets/$1 -f RewriteRule ^(.*)$ assets/$1 [L] # other requests to index.php RewriteRule !^asset/ index.php

Fake Subdomain with mod-rewrite

自闭症网瘾萝莉.ら 提交于 2019-12-12 03:54:19
问题 Sorry to ask this... I have seen various answers on this but I can't find one to help me (prob because I am very new to this process) Heres the issue. I want to fake a sub domain so that people go to sub.domain.co.uk but the server reads it as domain.co.uk/?event=sub then they can add other prams like sub.domain.co.uk/Login which leads to domain.co.uk/?event=sub&url=Login etc etc The code I have so far is this: RewriteCond %{REQUEST_URI} !\.(php|html?|jpg|gif)$ RewriteRule ^(.*)([^/])$ http:/

DNS/.htaccess files to redirect subdomain to specific folder

江枫思渺然 提交于 2019-12-12 03:54:00
问题 I'm trying to redirect my subdomain to a flder. I think I have the .htaccess code from another post here. Something like: RewriteEngine on RewriteCond %{HTTP_HOST} ^clients\.example\.com$ RewriteRule ^ http://example.com/clients/root/app%{REQUEST_URI} [L,P] What DNS settings should I set up for the clients. subdomain to tie it in with the .htaccess. 回答1: You need to create a CNAME to point clients.example.com to the same server as example.com . Then you need to make sure your webserver is

Rewrite a URL to include an extra parameter with a space in it

﹥>﹥吖頭↗ 提交于 2019-12-12 03:53:42
问题 Now that .htaccess rewrites all URLs and includes a parameter, how can that parameter have a space in it? For example http://old.io --> http://new.com?pa=v%20a While %20 works when testing in a .htaccess simulator, it doesn't work on my DreamHost account. http://new.com?pa=v%20a --> http://new.com?pa=v0a http://new.com?pa=v\ a --> http://new.com?pa=v a http://new.com?pa=v%2520a --> http://new.com?pa=v520a adding the NE flag doesn't change anything 回答1: You're right; Even though adding %20

Rewrite rule for redirect url

左心房为你撑大大i 提交于 2019-12-12 03:53:08
问题 I want to apply rewrite rule for achieve this. current url : http://localhost/mysite/?userlogin rewrite url : http://localhost/mysite/userlogin I want to do like when any user open http://localhost/mysite/userlogin this url, at that time user must get view of http://localhost/mysite/?userlogin this url. [Note] : current url is working right now..But I m getting Object Not found on rewrite url. Thanks in advance. 回答1: If you are using an Apache server You can do this creating a .htaccess in