htaccess won't redirect to a file even though it exists.

Asked by:
richard87 / 13 Points
Time:
2012-12-11 10:00 am EST
Category:
Htaccess
Hits:
1,322
Hi, I have this htaccess file in my root directory:
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ parse.php

parse.php does exist in my root directory.

and I get a 404 page when I access my site, however if I change the RewriteRule to:
RewriteRule ^(.*)$ http://google.com
it redirects to google.

or
RewriteRule ^(.*)$ index.php
index.php appears but kind of text only, as if it's not including all the other files.

Is there some syntax or some thing I'm missing to redirect to this file?

Thanks :D

edit, for php file exists in root directory

To ask this user for more information, please first login.

To submit an answer, please login.

Best answer chosen by User

0

ScottM
Staff
13,037 Points
2012-12-11 2:13 pm EST
Hello richard87,

The issue is due to the temp URL. When I made a hosts file modification to be able to use your domain name, the code works. When using the Tmep URL, the code does now.

The code you have redirects to parse.php regardless of what is put into the URL. I left that code commented out as well as a second set of code that redirects to parse.php if a file or directory entered does not exist. You can test them both with the host file modification to ensure they work.

Best Regards,
Scott M

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.