I've created a web service using php, slim and mysql but when I try to access the urls it gives me "The server encountered an internal error or misconfiguration and was unable to complete your request."
When I check the log it gives me :
C:/wamp/www/task_manager/.htaccess: Invalid command '.htaccess', perhaps misspelled or defined by a module not included in the server configuration
I checked few things online and I can ensure you that rewrite_module is installed and activated (not commented in the http.config
does anyone know how to fix that?
I ll attach the content of my .htaccess
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
Remove the line .htaccess from your .htaccess file.
if you install new wamp on your system,
and you are using htaccess in your project to rewrite some urls first you need:
Click on wamp icon and Go to "Apache" Then Click on "Apache Modules"
and make sure your RE WRITE extension should be checked.
Related
I have a problem with my .htaccess file.
In my .htaccess file I have this:
RewriteEngine on
RewriteRule ^user/([0-9a-zA-Z]+) user.php?u=$1 [NC, L]
And it is placed in my C:/../wamp/www/mysite/
My site worked before I had this file, so I'm not sure what I'm doing wrong.
I'm kind of new to this aswell so it's bound to go wrong.
Whenever I run my site I get the error:
Internal Server Error
"The server encountered an internal error or misconfiguration and was unable to complete your request."
You haven't finished the rule, change it to:
RewriteRule ^user/([0-9a-zA-Z]+)$ user.php?u=$1 [NC,L]
#-------------------------------^
Okay, now that it looks like you haven't enabled the rewrite engine. Check .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration for more information on how to enable it.
Update: If you are struggling with this, there's a Youtube video on how to do it: Youtube: How to enable rewrite module in WAMP Server?
Update: If you get Bad Flag Delimiters error, please don't give any spaces between the flags. For more information, see RewriteRule Error: Bad flag delimiters.
I am on a VPS running Ubuntu 14.04 x64, and I have enabled mod_rewrite.
This works (i.e. correctly redirects to testfile.php):
RewriteRule ^othername$ testfile.php
But this doesn't (gives me a 404 error, saying "The requested URL /testfile was not found on this server"):
RewriteRule ^testfile$ testfile.php
So I essentially cannot redirect a URL to a file of the same name but with a PHP extension. The two examples are both working locally with MAMP.
What could be causing this issue?
As anubhava said, you just have to add Options -MultiViews at the top of your .htaccess.
I had developed a website using Codeigniter. It was working good in localhost. When i hosted it and clicked on links i get "Internal Server Error".
Also i'm not able to see .htaccess files. Please tell me what i'm missing.
Works perfectly
Localhost:
$config['base_url'] = 'http://localhost/site/';
Welcome
When clicked above link, it goes to below url and works perfectly
http://localhost/site/welcome/page
Hosted
Public Web Server (Error):
$config['base_url'] = 'http://www.mysite.com/';
Welcome
When clicked above link, it goes to below url and gives an error
http://mysite.com/welcome/page
If you have access to the Apache error logs check those for why you are getting the 'Internal Server Error.'
On a Linux server those are usually found in '/var/log/apache2/error.log.'
On a Windows server they can by default be found in something like 'C:\Program Files\Apache\logs.' Or you can find out the location by looking in the conf file or virtual hosts conf file if you use that.
try
Welcome
see docs http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html
OR to hide index.php
add .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I am trying to access localhost on my xampp via the Chrome browser but I get this error message:
Object not found!
The requested URL was not found on this server. If you entered the
URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
Apache and MySQL are turned on so I don't understand.
You can access "localhost" just fine.
The "404: file not found" error indicates the server can't find the requested file once you've connected to localhost.
ADDENDUM:
Maybe try to create a regular html file called test.html in one of
your vhosts that is not working. Then try to visit that url. That
should give you some clue as to what may be the problem. – Gohn67
This is good advice. Try it. Specifically:
1) Create the following five files:
C:/xampp/htdocs/dummy-host.localhost/test.html
C:/xampp/htdocs/my/test.html
C:/xampp/htdocs/launcher/public_html/test.html
C:/xampp/htdocs/website/httpdocs/test.html
C:/xampp/htdocs/my/test.html
2) Make sure each of these directories exist, and each has a "test.html" with the words "TESTING 1...2...3" in it
3) Try each of these five URLs in your browser:
http://localhost/test.html
http://itutormaths.web/test.html
http://itutormaths.mod/test.html
http://itutormaths.hub/test.html
http://my.itm/test.html
4) Report back the exact error you get from each browser URL
Navigate here:
http://localhost/
If that works, everything is okay.
Paste wordpress to xampp/htdocs, and you should not get any error.
I had a similar issue and this is how I resolved it:
Open the httpd:conf file on the Apache module in XAMPP (click the Congif button)
Scroll through the file - after the first set of comments (#) there is a line of code which says 'Listen 80'. Change this to 81 (or whatever other port you want to use).
Open web browser and explicitly define the port in the web address:
127.0.0.1:81
The may or may work for you; I initially had the issue that Apache wouldn't start at all, which is why I changed the port number (couldn't be bothered to figure out which service was using port 80 - if you want to you can use the command netstats -a or netstats -b in command prompt to figure it out)
Hope this helps
I just encountered this and solve this by creating .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /yourfoldername/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I created a zend project on localhost on ubuntu OS and it is working perfectly on my local system. Now I want to upload this project online. I purchased domain name and hosting. I got following directory structure to upload files.
/www.example.com/web/content/
So www.example.com is pointing to /www.example.com/web/content/ folder. This directory structure is unchangeable. I put all public folder files to /www.example.com/web/content/ and application, library and tests folders into /www.example.com/web/. So it is the same directory as my local system but only public folder is renamed to content folder.
Now homepage is successfully shown but whenver I click any link or redirect to any other webpage, I got following error.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2 Server at example.com Port 80
Any idea ?
Thanks
Internal server (HTTP 500) errors can occur for many reasons. You should check your web server's error log for more details. If you don't have access to your vhosts' error log, ask your host to see what's going wrong.
It is solved after reading following thread:
http://www.zfforums.com/zend-framework-general-discussions-1/installation-configuration-3/problems-1and1-hosting-560.html
So it is working using following .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>