Sunday 15 October 2017

.htaccess - override apache rewrite rules with htaccess

working on a server that hosts multiple
domains.
Somewhere in apache config is a rewrite rule that is set for ALL
domains.




What happens is if a user
goes to example.com/foo they are supposed to get redirected to
example.com/foo_bar



However, in one domain, I
want to override this behavior so that the url stays at example.com/foo and does not
redirect. I've been searching and trying various rules and conditions to no avail. I
don't have access to the apache config, but I am using .htaccess for some rewrite rules
on this domain.



here's my rewrite rules in
.htaccess:



            mod_rewrite.c>
RewriteEngine on

# this isn't
working

# RewriteRule ^(foo)($|/) - [L]


RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$
index.php?/$1

# this didn't work either
# RewriteRule
^/foo index.php?/$1
[L]


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...