mod-rewrite

DNS error with Dynamic subdomains with htaccess

我的未来我决定 提交于 2020-01-11 13:01:13
问题 i'm trying to implement dinamics subdomains for cityes, but this not work when a subdomain is used. My htaccess is: Options +FollowSymlinks <IfModule mod_rewrite.c> RewriteCond %{HTTP_HOST} ^www.bisnet.com.co [NC] RewriteRule ^(.*)$ http://bisnet.com.co/$1 [R=301,L] </IfModule> <IfModule mod_rewrite.c> RewriteCond %{HTTP_HOST} ^www.bisnetcolombia.com [NC] RewriteRule ^(.*)$ http://bisnet.com.co/$1 [R=301,L] </IfModule> <IfModule mod_rewrite.c> RewriteCond %{HTTP_HOST} ^www.bisnet.co [NC]

simple 301 redirect with variable not working, why?

落花浮王杯 提交于 2020-01-11 11:59:28
问题 Here's what I got so far. The first part works but not the redirect itself. What do I need to do to make it work? RewriteEngine On RewriteRule ^([^/\.]+)/?$ page.php?name=$1 [L] RewriteRule ^page.php?name=([^/\.]+)/?$ /$1 [R=301,L] Also if I have multiple of these rules do I leave the [L] only on the last one? 回答1: Besides the first rule overriding the second one, your second rule also won't work because you're trying to match the query string in a RewriteRule. Try something like this instead

simple 301 redirect with variable not working, why?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-11 11:59:08
问题 Here's what I got so far. The first part works but not the redirect itself. What do I need to do to make it work? RewriteEngine On RewriteRule ^([^/\.]+)/?$ page.php?name=$1 [L] RewriteRule ^page.php?name=([^/\.]+)/?$ /$1 [R=301,L] Also if I have multiple of these rules do I leave the [L] only on the last one? 回答1: Besides the first rule overriding the second one, your second rule also won't work because you're trying to match the query string in a RewriteRule. Try something like this instead

Apache appends trailing slash to my rewrite rule

我们两清 提交于 2020-01-11 11:52:29
问题 I have clean path with the same name as existing directory. I use these .htaccess rules to support clean path for the path: RewriteCond ${REQUEST_URI} ^/mydir RewriteCond ${REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] everything works correctly (I have a "mydir" clean path working and I can access existing files in the /mydir directory directly), but apache appends the trailing slash all the time to requests. I request http://domain.com/mydir , and it redirects me 301 to http://domain

htaccess simple Redirect doesn't work with trailing slash

≯℡__Kan透↙ 提交于 2020-01-11 11:34:31
问题 I find a lot of answers to this question (and I have read dozens of them), but they are all about more advanced stuff with patterns and such stuff. I just need a very simple and basic redirect for static urls. If I add a trailing slash to the url, the redirect doesn't work and I just can't figure out why. Example: RewriteEngine On Redirect 301 /content https://www.example.com/site/content.html Redirect 301 /content/ https://www.example.com/site/content.html https://example.com/content does

GET variable after mod_rewrite

夙愿已清 提交于 2020-01-11 06:50:11
问题 I have a set of product pages that obey the following htaccess rule: RewriteCond %{REQUEST_FILENAME} !-s RewriteCond %{REQUEST_URI} ^/([0-9]+)\-(.+)\.html RewriteRule ^(.*)$ /product/index.php?prod=%1-%2 [L] Which rewrites them to: example.com/123-1234.html. My problem is that I can no longer pass additional $_GET variables to the page - IE: example.com/123-1234.html?coupon=something123. Is there any way to do this? 回答1: Your looking for QSA, Query String Append RewriteCond %{REQUEST_FILENAME

.htaccess redirect if ANY query string is present?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-11 06:42:09
问题 I have the following .htaccess at present. <IfModule mod_suphp.c> suPHP_ConfigPath /home/abc/php.ini </IfModule> RewriteEngine on RewriteCond $1 !^(index\.php|media|css|js|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] AuthType Basic AuthName "Está dominado!!" AuthUserFile "/home/abc/.htpasswds/public_html/passwd" require valid-user Now the thing is, I would like to, if any query string is found after a / remove that query string. So: If we have: http://www.abc.com/

RewriteRule - two parameters but last parameter is optional

久未见 提交于 2020-01-11 04:45:08
问题 I cannot rewrite to include two parameters but the last parameter is optional, so for example: http://www.mywebsite.com/friends/jamie - (the forward slash should be optional too). Which should be the same as this: http://www.mywebsite.com/friends.php?name=jamie When including a second parameter http://www.mywebsite.com/friends/jamie/30 - Should be the same as this: http://www.mywebsite.com/friends.php?name=jamie&page=30 This rule does not work: RewriteRule ^friends/(.*)/(.*)$ friends.php?name

Using .htaccess to replace backslash in URL with forward-slash

江枫思渺然 提交于 2020-01-11 04:08:05
问题 I realise that a backslash should never appear in a URL in a form other than a URL escape code, however in this case the URL's are being generated by a .NET application for generating flashbooks. I have contacted the developer of this application with a bug report. In the interim i would like to use .htaccess to rewrite the offending backslashes. This is how the URLs appear in fiddler debugging proxy. www.example.com/folder/folder/thumbs%5C1.jpg I am using Firefox and it looks as though

In .htaccess, redirect all domains except one

谁说胖子不能爱 提交于 2020-01-10 23:01:34
问题 I have multiple domains on my server. I want to redirect all of them to one (example.net). My .htaccess: RewriteEngine on RewriteRule ^(.*)$ http://www.example.net/$1 [R=301,L] I’m redirecting all URLs on my server to one main domain, but that domain is also redirecting to itself. So www.example.net returns 301 Moved Permanently and redirects back to itself. I’m told that this isn’t good for SEO. How could I fix this? 回答1: You need to add a Rewritecond to prevent it from redirecting when you