I am making an url shortener with a base 64 encoding for my urls. problem is I also have a bunch of folders inside my main directory. My directory looks something like this
/
/css
style.css
/handlers
handle_database.php
index.php
.htaccess
And this is the rewrite rule I use to capture the encoded urls
RewriteRule ^([A-Za-z0-9_-]{3,8})$ index.php?a=$1
And that works. my problem comes when my system generates an url that would be like this http://exampleurlshortener.com/css, in an ideal scenario the rewrite rule would capture the "css" and let my index.php handle the rest, problem is apache adds a trailing slash and it ends up getting inside the css directory.
So what I need is that
http://exampleurlshortener/css -> lets index.php handle the request
http://exampleurlshortener/css/ -> access the actual directory
So far I've had no luck, because apache keeps adding the trailing slash
0 comments:
Post a Comment