skolind
skolind

Reputation: 1754

.htaccess - Localhost working in a folder problems

I'm working localhost on my mac with MAMP. And I'm trying to do some mod_rewrite with .htaccess. I think all my problems is about that I'm working on a URL like this: localhost:8888/folder/index.php.

How do I either "remove" the /folder/... Or make .htaccess work with /folder/ having in mind that I wanna remove it as soon as my project goes live? *I would prefer to "remove" the /folder/ to make it look more like when my project goes live.

If I am trying to for example "remove" the index.php like this:

#Removes index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

It's jumping all the way back to root: localhost:8888/ instead of localhost:8888/social/.

Upvotes: 0

Views: 206

Answers (1)

Pancho
Pancho

Reputation: 120

Had the same problem and just found a solution.(I know i may be late to this post, but might help some else)

The problem I had was with the my local web enviorment. I tried it on the server and everything was working! So found out that I just needed to set up the Virtual Hosts for my sites in apache and everything worked great!

I did this with the help of this stackoverlfow post: How to set root directory to a subfolder and this article on how to do this on a windows PC: Setting up Virtual hosts in win 7

Hope it helps, Cheers!

Upvotes: 2

Related Questions