rewrite

IIS 7 - Rewrite rule not firing, but does work with Redirect

风流意气都作罢 提交于 2021-02-11 17:58:29
问题 I have the following rewrite rule set up on IIS 7: <rule name="Rewrite /publicfiles/GUID/file.ext" stopProcessing="true"> <match url="^/?publicfiles/(.*)/(.*)" /> <action type="Rewrite" url="http://www.domain.tld" appendQueryString="false" / </rule> When I try it out it appears to not fire. I get a 404 error, but if I change the type to Redirect it fires and sends me to the URL specified. Is someone able to shed some light on this? EDIT: I added the definition of the rule to the web.config of

Nginx config rewrite with PATH_INFO

倾然丶 夕夏残阳落幕 提交于 2021-02-08 10:13:54
问题 I create .htaccess file in folder /var/www/project/ : <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(statics/([a-zA-Z0-9\-\/.]+)|index\.php)$ #ignore folder statics RewriteRule ^([a-zA-Z0-9\-\/.]+)$ index.php/$1 [QSA,L] #Add path_info </IfModule> <Files *.php> Order Deny,Allow Deny from all </Files> <Files index.php> Order Allow,Deny Allow from all </Files> index.php: <?php echo 'Path: ', $_SERVER['PATH_INFO'

Nginx rewrite rules for SEO friendly URL structure - WordPress and another Web application

强颜欢笑 提交于 2021-02-08 08:29:19
问题 I have got WordPress installed on my root example.com/ Website. Also I have another Web application that on example.com/my-app/ which has got ugly links like example.com/my-app/file.php?arg=value to access. How can I make my-app SEO friendly URI structure working as example below?: example.com/my-app/file.php?arg=value to example.com/my-app/value/ Currently, if I access to example.com/my-app/value/ it redirects me to my WordPress post which contains some characters of the /value/. Why? Is

htaccess: Remove and disable file ending

为君一笑 提交于 2021-02-08 05:11:46
问题 I'd plastered all over the Internet that this code in your .htaccess file will remove the file ending: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php However, although enables the URL without file ending, it does not disable the URL with file ending. Essentially, what I'd like to force any attempt for an request with file ending (domain.com/sample.php) to end up without file ending (domain.com/sample) I'm sure someone

Rewrite rule for the root file in nginx?

拈花ヽ惹草 提交于 2021-01-28 15:54:09
问题 I just want to redirect / to a different file rather than index.php/.html. So on apache I can do this.. RewriteCond %{REQUEST_FILENAME} -f RewriteRule . /path/to/dir/index.html [L] Trying this in nginx just doesn't even get run, it seems: if (-f $request_filename){ set $rule_0 1$rule_0; } if ($rule_0 = "1"){ rewrite /. /path/to/dir/index.html last; } Also tried this: if ($request_filename ~ "/index.php"){ set $rule_3 1$rule_3; } if ($args ~ "^$"){ set $rule_3 2$rule_3; } if ($rule_3 = "21"){

Rewrite rule for the root file in nginx?

偶尔善良 提交于 2021-01-28 15:40:21
问题 I just want to redirect / to a different file rather than index.php/.html. So on apache I can do this.. RewriteCond %{REQUEST_FILENAME} -f RewriteRule . /path/to/dir/index.html [L] Trying this in nginx just doesn't even get run, it seems: if (-f $request_filename){ set $rule_0 1$rule_0; } if ($rule_0 = "1"){ rewrite /. /path/to/dir/index.html last; } Also tried this: if ($request_filename ~ "/index.php"){ set $rule_3 1$rule_3; } if ($args ~ "^$"){ set $rule_3 2$rule_3; } if ($rule_3 = "21"){

htaccess rewrite returns 404 not found

本小妞迷上赌 提交于 2021-01-27 21:15:26
问题 I want it so that if the user types webaddress.com/artist/P1/P2/ it will make it use /artist/index.php?artist=P1&am=P2 P1 would be an artist name, so it could contain both letters and numbers. P2 would be a number, so just numbers. I want it so that P1 would be esssential, whereas P2 isn't because right now it just returns 404 not found on that address. Current code: RewriteEngine on RewriteRule ^artist/([^/]+)/(\d+)/$ /artist/index.php?artist=$1&am=$2 [L] 回答1: /artist/index.php implies there

nginx rewrite伪静态后产生的错误链接

删除回忆录丶 提交于 2021-01-22 09:42:38
###背景 网站采用PHP做为后端开发语言,采用Thinkphp作为核心开发框架。 ###问题 //一般的URL生成方式为 U('xxx/xxx',[a=>b]); //目前网站中存在这种写法 U('xxx/xxx').'&a=b'; /* 上面不规范写法在伪静态前与伪静态后生成的URL对比 伪静态前:/index.php?mod=xxx&act=xxx&a=b 可以正常访问 伪静态后:/xxx/xxx.html&a=b 404 */ 如果去花时间修复这种不规范的写法,不仅费时费力,而且后期也难免出现这种不规范的写法。 所以考虑使用nginx rewrite模块重写为正确的URL ###解决方法 #为第一次出现伪静态后缀的URL添加? rewrite ^(.*?)\.(html|php)[^\?](.*)$ $1.$2?$3 last; 来源: oschina 链接: https://my.oschina.net/u/135537/blog/510761

Apache: edit to .conf file produces “Invalid command 'Header'”

▼魔方 西西 提交于 2020-08-22 00:40:06
问题 In Magento CE, I'd like to install an add-on to Extendware Page Cache called Lightening Cache. It requires editing the Apache configuration inside the virtual host definition for the site, by adding: RewriteEngine On RewriteMap ewpchash prg:/home/.../shell/extendware/ewpagecache/apache/md5.php RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !\.(js|css|png|jpg|jpeg|ico|gif)$ [NC] RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f RewriteCond ${ewpchash:%{HTTPS};~;%{HTTP_HOST};~;

Apache: edit to .conf file produces “Invalid command 'Header'”

别等时光非礼了梦想. 提交于 2020-08-22 00:14:16
问题 In Magento CE, I'd like to install an add-on to Extendware Page Cache called Lightening Cache. It requires editing the Apache configuration inside the virtual host definition for the site, by adding: RewriteEngine On RewriteMap ewpchash prg:/home/.../shell/extendware/ewpagecache/apache/md5.php RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !\.(js|css|png|jpg|jpeg|ico|gif)$ [NC] RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f RewriteCond ${ewpchash:%{HTTPS};~;%{HTTP_HOST};~;