.htaccess

.htaccess Redirect non-www domains including subdirectoies to www and exclude subdomains

和自甴很熟 提交于 2020-01-11 13:11:04
问题 I know there's tons of docs on any one of these items, but I can't seem to find the .htaccess code to do all of them together. Goal/requirements: No prefix domain.tld redirects to www.domain.tld Subdomain'd domain (ex. mail.domain.tld) still goes to mail.domain.tld, i.e. does not get redirected to www.domain.tld Domain.tld/subdirectory redirects to www.domain.tld/subdirectory. NOTE: domains will vary, but subdirectory will always be the same, i.e. all domains have the subdirectory. For

.htaccess Redirect non-www domains including subdirectoies to www and exclude subdomains

微笑、不失礼 提交于 2020-01-11 13:08:53
问题 I know there's tons of docs on any one of these items, but I can't seem to find the .htaccess code to do all of them together. Goal/requirements: No prefix domain.tld redirects to www.domain.tld Subdomain'd domain (ex. mail.domain.tld) still goes to mail.domain.tld, i.e. does not get redirected to www.domain.tld Domain.tld/subdirectory redirects to www.domain.tld/subdirectory. NOTE: domains will vary, but subdirectory will always be the same, i.e. all domains have the subdirectory. For

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

how to hide folder name from url using .htaccess

こ雲淡風輕ζ 提交于 2020-01-11 11:52:07
问题 I have a domain example.com i want to redirect it to example.com/public but /public folder should hide from the url. I am using the below code in .htaccess to redirect, but unable to hide the folder name RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteRule ^$ public [L] Please help me out for this issue. 回答1: You can try this RewriteEngine on RewriteCond %{REQUEST_URI} !^/(public) RewriteRule (.*) /public/$1 回答2: This should

how to hide folder name from url using .htaccess

与世无争的帅哥 提交于 2020-01-11 11:51:54
问题 I have a domain example.com i want to redirect it to example.com/public but /public folder should hide from the url. I am using the below code in .htaccess to redirect, but unable to hide the folder name RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteRule ^$ public [L] Please help me out for this issue. 回答1: You can try this RewriteEngine on RewriteCond %{REQUEST_URI} !^/(public) RewriteRule (.*) /public/$1 回答2: This should

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

Codeigniter htaccess not working on godaddy?

夙愿已清 提交于 2020-01-11 11:29:34
问题 I recently moved to godaddy Linux hosting and the .htaccess doesn't seem to work. Are there any settings which need to be done for godaddy because the .htaccess was working on local xampp server as well as hostek server.I am getting "404 Not Found" error message.i am using CodeIgniter-2.2.1 framework also i have check mod_rewrite in Loaded Modules in php.ini file was not found enable from server side . My htaccess file located on root directory where my application is deployed. RewriteEngine