Mod rewrite problem....

I asked a similar question to this a few days ago but due to a server change it is resurfacing.

I am attempting to rewrite a URL like this billsprice.com/blue

but the problem I have now is it messes up every other directory where I dont specify a file....
for example billsprice.com does not work....billsprice.com/index.php does work

Below is my .htaccess file, thoughts? htaccess htaccess
blink10Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dushyant SharmaCommented:
can you give some more details on the problem like what happen when you enter billsprice.com only. Also for other directories what is the exact problem.

It looks like you are manipulating the query string using apache. So for url billsprice.com it will give the url as
/username.php?username= (here no parameters will be passed). may be that is causing the problem.

to overcome this you can try adding rewritebase condition for the main url as below

RewriteBase /
RewriteRule ^index\.php$ - [L]

this should be placed before the other rules.. i.e. just after "RewriteEngine on" directive.

Hope this helps

0
blink10Author Commented:
Now i cant get index.php to load whatsoever. Thoughts?
2Untitled.png
0
Dushyant SharmaCommented:
can you write in detail what exactly is your requirement?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

blink10Author Commented:
Any visitors can see a users profile by going to billsprice.com/Username (but instead of the "username" it will be that person's username)

So the following needs to occur...

If user types billsprice.com/Something

It first check /Something isnt a directory then if its not it send it to username.php and then username.php sends them to a 404 if that user doesnt exist.

Make sense?
0
Dushyant SharmaCommented:
Yes that is more clear. try this.

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.php -f
RewriteRule ^ %{REQUEST_FILENAME}/index.php [L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule ^ 404/ [L]

RewriteRule ^(.*)$ ./username.php?username=$1 [QSA,L]

in the first condition if index.php exists in the directy it will be fetched. second one if index.php does not exist it will fetch 404. last is the rule as you required. now the php should take care of fetching 404 if the user does not exist.

Hope this helps..
0
blink10Author Commented:
Ok now I am getting a 500 server error on ever page, thoughts? htaccess
0
Dushyant SharmaCommented:
what is the error. can you check the logs?
0
blink10Author Commented:
I think this is the erorr....not sure though, but its a 500 level error, i know that.

[Thu Jan 05 05:56:19 2012] [client 66.249.67.203] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
0
Dushyant SharmaCommented:
ah.. yes my bad.. let me check at my end.
0
Dushyant SharmaCommented:
well the first one should serve the purpose

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./username.php?username=$1 [QSA,L]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
blink10Author Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.