How to write multiple rules in htaccess

I am using a codeigniter framework for my site and I also have a blog site that runs in wordpress. My site url looks like this

AND my blog url

. i wrote htaccess for my site like this

RewriteRule ^([^.]+)$ index.php/profile/fundraiser/$1

Whenever I grab my blog site, it always redirects to the profile controller (which is defined in the htaccess). If url https://mydomain/blog

, it should redirect to my blog, and other times it should redirect to profile controller. Can I write multiple Htaccess rules for this, since I put both files on the same domain? Anyone please help me.


source to share

1 answer

You must use rewrite condition like below -

RewriteCond $1 !^(blog)
RewriteRule ^([^.]+)$ index.php/profile/fundraiser/$1


i.e. only when the url does not contain a blog is it redirected to the profile page. You can add more conditions for each rule.



All Articles