I currently use a RewriteRule to direct all traffic to a index.php file which then decides which page to serve.
#Hide Index
IndexIgnore *
#Define ErrorDoc
ErrorDocument 404 http://www.domain.com
#REDIRECTS
Redirect 301 /page.php http://domain.com
Redirect 301 /inc/page.php http://domain.com
Options +FollowSymlinks
RewriteEngine on
#Redirect all pages in a folder to a single URL
RewriteRule ^dir/(.*)$ http://domain.com/index.php [L,R=301]
#Redirect String
RewriteRule ^index.php?var1=value&var2=(.*)
Already i have rewrite rule in htaccess.
I have these rewrite rules (I tried both with no avail):
location ~* "^/([a-z0-9]{32})\.png$" {
rewrite ^ /index.php?page=log&id=$1 last;
}
and
location ~* "/(?<hash>[a-z0-9]{32})\.png" {
rewrite ^ /index.php?page=log&id=$hash;
}
and
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite "^/([a-zA-Z0-9]{32})\.png$" /index.php?page=log&id=$1 l
Consider this code:
RewriteEngine On
RewriteRule ^$ http://%{HTTP_HOST}:8177/index.jsp [C]
RewriteRule ^http://([^:]+):([^/]+)(.*) http://$1:8177$3 [R=301]
RewriteRule ^/$ http://%{HTTP_HOST}:8177/index.jsp [C]
RewriteRule ^http://([^:]+):([^/]+)(.*) http://$1:8177$3 [R=301]
RewriteCond %{REQUEST_URI} card.*
RewriteRule ^ - [L]
RewriteCond %{REQUEST_URI} Voucher.*
RewriteRule ^ - [L]
Rewr
I am trying to convert a very simple rewrite from a previous nginx version to the current one looking like below:
location / {
if ( !-f $request_filename ) {
rewrite ^/([a-z]*)$ /index.php?action=$1;
rewrite ^/([a-z]*)/(.*)$ /index.php?action=$1&item=$2;
}
}
This is how far I have gotten.
RewriteRule ^([^/]*)/([^/]*)$ /index.php?id=$1&n=$2 [L]
This rule will write website.com/4/name to
/index.php?id=4&n=name
How can I add/change the rule to stop calls to website.com/blog/login.php from rewriting?
Answer
Per Shane's comment, and looking closer at the regex:
RewriteRule ^([^/]*)/([^/]*)$ /index.php?id=$1&n=$2 [L]
1 First Expression
^([^/]*)
I am very new in rewriting in nginx but although I've spent 2 days reading on forums, I still can't get some Codeigniter rewrites working ...
Hi,
I wanted my test.example.com/index.html(only) to redirect to test.example.com/index.html?NEW=1.. I have the below rewrite rule but that was not working getting redirect loop error.
Rules
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteRule ^index.html$ /index.html?NEW=1 [L]
Please guide me
Regards
Wintech