PHP rewrite giving 404, .htaccess problem? - php

I have the following .htaccess:
#Options +FollowSymLinks
RewriteEngine on
RewriteBase /phptest
on my local testing server (http://localhost) I have to uncomment the first line for the site to work. Otherwise I get Error 403 (Forbidden).
Once I upload the page to my webserver (FastHosts) I get Error 500 (Internal Server Error) if the first line is not commented out.
If I comment it out, my page loads but it cannot find the page content which is mydomain.com/phptest/Home
I get a 404.
Any suggestions on what the problem might be?

Check for mod_negotiation to be disabled. It gives unexpected results in combination with mod_rewrite.

I think you need to modify your httpd.conf to allow for AllowOverride All
What does your error log say?

Can you please check whether mod_rewrite is enable or not in your php.ini file. If not then please enable that.

Related

Why does this Rewrite rule throws a 500 inside .htaccess file?

on a server with PHP and mod_rewrite I have the following .htaccess in the document root:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .(rewriteme)$ rewrite.php [L]
</IfModule>
When I make a request to http://theserver.com/arewriteme, I get a 500 internal server error.
But on my local system, the rule above works great and the script rewrite.php is executed (it simply echoes It works!) when I request http://localhost/arewriteme:
<?php echo "It works!"; ?>
Why do I get a 500 error on the remote server though? I don't have access to the global Apache configuration, but I am sure the module gets loaded as `phpinfo() shows:
I looked at different questions here on SO, but basically all say that it the error is due a syntax error within .htaccess (which is not my case because the rule works on localhost).
So, maybe, there's something in the global configuration of Apache? Maybe the creation of .htaccess is somehow denied? Could it be possible?
Thanks for the attention.
EDIT: I was able to contact the hosting provider and they told me that they disabled .htaccess throught the whole htdocs directory. How did they do that so that the server thrown a 500 Internal Server Error? AllowOverride None inside the main Apache won't do the job because in this case Apache would simply ignore the rules inside the .htaccess but won't throw any error...

500 internal server error comes up when i use .htaccess file in wamp server

i was trying to rewrite my post url with htaccess file when i put it into my project directory with following code in the htaccess file 500 internal error comes up, but when i left it(htaccess) blank without any code the page loads perfectly.
RewriteEngine on
RewriteRule ^post post.php
Error is:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at admin#example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
what might be the issue, is there any permission need to be granted or any directives need to be on in config file or php.ini i am new in php development. plz help.
Thank you
It must be
RewriteEngine on
RewriteRule ^post$ post.php
try:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^post post.php [L,R=301]
</IfModule>
With this code the error should disappear but it's possible that your rule is not applying correctly, in this case we will fix

FallbackResource causes net::ERR_INCOMPLETE_CHUNKED_ENCODING

When I use a .htaccess that contains just this line:
FallbackResource index.php
I get this error on Chrome only:
net::ERR_INCOMPLETE_CHUNKED_ENCODING
The error appears only when access the root directory where the .htaccess is located.
IE, if .htacess is in www.mysite.org/admin then the error only appears when I type that exact URL in the nav bar.
If I go to www.mysite.org/admin/index.php or www.mysite.org/admin/some-user-friendly-url there is no error.
The error is really annoying as it delays the page load by several seconds and makes the page fail to execute some JavaScript that should happen on page load.
Like many others with this error, it only happens in Chrome. Solutions from other posts were of no help in my particular case.
Add DirectoryIndex directive to .htaccess file before FallbackResource. This fixed the problem for me.
DirectoryIndex index.php

.htaccess causing 500 error

I have only a single line in the .htaccess file:
RewriteEngine On
Taking that line out makes the error go away. I've checked as many places as I know of for the AllowOverride rule (but I know next to nothing about how that works) and I thiiiiink it's set correctly, but I don't know for sure.
I can't figure out what's going on and I'm not sure what to even check. Any ideas? Thanks in advance.
Enable the rewrite module in apache by command on ( for Ubuntu )
sudo a2enmod rewrite
Try replacing it with:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule

Mod redirct error

when I used the SSL fot my website i got following error.
in error log. and site shows me default page instead of actual page.
I got following error.
.htaccess: RewriteEngine not allowed here
Is AllowOverride FileInfo or AllowOverride All on in your server configuration? Typically, HTTPS and HTTP sites use different configuration sections or files. Make sure your site is properly configured.

Categories