Welcome Guest, Not a member yet? Register   Sign In
htaccess help

My htaccess skills are pretty much null, and I have tried figuring it out myself looking online but I am at a loss.

This is what I need to do.

CI is installed in a sub directory called ci

I need it so the following links both point to it

www.example.com/articles points to www.example.com/ci


www.example.com/categories points to www.example.com/ci

the obviously the controllers and methods work accordingly from there.

So that if I went to


it would really be pointing at www.example.com/ci/view/3


So far I have this:

RewriteRule ^articles /ci/index.php?/$1 [NC]
RewriteRule ^articles/(.*)$ /ci/index.php?/$1 [NC]

And this does work.

However with my config base_url set to www.example.com/ci/

None of my images or javascript shows up because its not referencing it properly. Would I guess that I just can't use base_url in my views?

I want to be able to use finctions like img() but I don't seem to be able to because it adds the base_url

I no longer need any help. I solved my issues by using site_url() instead of base_url()

Can someone tell me how to us .htaccess to add a trailing slash only if its a directory?

So this:

www.examples.com/articles would become www.examples.com/articles/

but if it was:


no trailing slash would be added


RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Maybe this might help someone sometime.

Theme © iAndrew 2016 - Forum software by © MyBB