mod-rewrite

How to bypass %23 (hash sign) through RewriteRule without data loss?

你。 提交于 2019-12-24 15:43:01
问题 I have the following .htaccess file: RewriteEngine On RewriteCond %{REQUEST_URI} !^/command RewriteRule .* /command/rewritehandler.php?q=%{REQUEST_URI} [B] See specs at currently unanswered question https://stackoverflow.com/questions/29376788/mod-rewrite-directives-and-valid-invalid-utf-8-characters-after-first-character . If request to server the following /aaa%23%23aa then rewritehandler.php receives only /aaa . Looks like REQUEST_URI only handles data before %23 . What I should type

mod rewrite rule to include period

时光总嘲笑我的痴心妄想 提交于 2019-12-24 15:40:28
问题 What should I add the rewrite rule to include reading periods? I have this currently on my .htaccess: RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]+)$ /user/public/index.php?username=$1 [L] if i have this it works fine: http://mydomain.com/user/public/usernamehere but if i have this i get the 404: http://mydomain.com/user/public/usernametwo.net Thanks. 回答1: Add the point to your set of allowed input. Try this... <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST

Redirect mobile website to subdomain

做~自己de王妃 提交于 2019-12-24 15:33:32
问题 I'm trying to redirect my website to a subdomain if visited from mobile clients but the .htaccess file doesn't seem to be working as I planned. I think it has something to do with the fact I'm also redirecting non-www to www in the htaccess but not sure. Any help would be appreciated! <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^mysite.com RewriteRule (.*) http://www.mysite.com/$1 [R=301,L] RewriteEngine On RewriteCond $1 !^(?:static|install)(?:/.*)?$ RewriteRule ^(.*)$

how to redirect to a subfolder from root, rewrite subfolder link to look like root, and then add some exceptions in htaccess?

吃可爱长大的小学妹 提交于 2019-12-24 15:24:55
问题 I beg you pardon if this is a duplicate question. What I've found on the net didn't satisfy me at all. As I asked in this question, I successfully rewrote the /public folder to the root url. So If I visit localhost or localhost/public apache redirects me to /public and hides public in the url. To sum up, I did it in this way: RewriteEngine on RewriteCond %{THE_REQUEST} /public/([^\s]+) [NC] RewriteRule ^ /%1 [NC,L,R] RewriteCond %{REQUEST_URI} !^/public RewriteRule ^(.*)$ /public/$1 [NC,L,QSA

multiple htaccess rewrite Conditions / angular routes html5 mode

谁说我不能喝 提交于 2019-12-24 15:11:37
问题 i have a angular project with routes in html5 mode. I set up a htaccess file, that is possible to insert a domain manually or refresh the page. here the htaccess code with works fine, based on this Still getting 'Not Found' when manually refreshing with angular.js route RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^ myFolder/myFile.php [L] but now i want also to redirect the url to https width www,

301 redirect to new domain and new name folder

…衆ロ難τιáo~ 提交于 2019-12-24 14:45:44
问题 I'm going to change my domain name but also need to change and one folder name on url structure. I want "www.example.com/name" to become "new-example.com/new-name". I have this code for .htaccess: RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteRule ^(?:name/?)?(.*)$ http://new-example.com/$1 [L,R=301,NC,NE] but this code remove "name" folder on redirected links. How can i change folder name and not remove it? 回答1: Try this rule as your very

htaccess rewrite to sub-domain

不问归期 提交于 2019-12-24 14:37:03
问题 Hi I have a independent site that sits within a sub-directory of a main server. All links within the sub-directory site point to the root and I'd like to capture those and send them back to the sub-directory rather than the root. Is this possible with htaccess? 回答1: This will not redirect to the subdir, but make the other domain behave as if the subdir is the document-root. Which I think is even better. RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^seconddomain.nl$ [NC] RewriteCond

Multi-Country Using .htacces

本小妞迷上赌 提交于 2019-12-24 14:34:37
问题 I am trying to achieve any one of the following: http://ca.domain.com/Category/SubCategory -> http://www.domain.com/index.php?country=ca&category=Category&subcategory=Subcategory http://www.domain.com/ca/Category/SubCategory -> http://www.domain.com/index.php?country=ca&category=Category&subcategory=Subcategory I have browsed around but unfortunately haven't been able to figure out any working solution. For the first kind I tried the following code: Options +FollowSymLinks RewriteEngine on

My mod_rewrite rules do not resolve PHP variables

ぃ、小莉子 提交于 2019-12-24 14:30:51
问题 I have an interesting situation. I've configured a basic LAMP server and an external company is providing us some code. Everything works except PHP rewrites specifically. I've successfully configured rewrites and can do basic rewrites like hello.html -> redir.html. I've also confirmed this by turning LogLevel up to trace6 and I see rewrite being active. the trouble comes with php variables. It seems to just not resolve them. I have the following simplified .htaccess file with all other rules

htaccess Url rewriting not working

一曲冷凌霜 提交于 2019-12-24 14:28:46
问题 I have a problem with the Apache URL rewriting, I want when the user tapes an url like this : 1 : www.site.com/country/city/smthg or 2 : www.site.com/country/city/smthg/fct or 3 : www.site.com/country/city/smthg/fct/value I want to transform the url to this: 1 : www.site.com/index.php/smthg/index/country/city 2 : www.site.com/index.php/smthg/fct/country/city 3 : www.site.com/index.php/smthg/fct/value/country/city I am using PHP Codeigniter framework, I tried this but it is not working :