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

[eluser]megabyte[/eluser]
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


and

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

www.example.com/articles/view/3

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



Thanks
#2

[eluser]megabyte[/eluser]
So far I have this:

Code:
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
#3

[eluser]megabyte[/eluser]
I no longer need any help. I solved my issues by using site_url() instead of base_url()
#4

[eluser]megabyte[/eluser]
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:

www.examples.com/articles/index.html

no trailing slash would be added
#5

[eluser]megabyte[/eluser]
Solved

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