.htaccess - slim framwork in 1and1 throws 404 error - .htaccess

I'm facing 404 error using slim framework with 1and1 hosting.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
tried all answers but not working. help me to get rid of this.
my path is
/api/users
and URL is
domain.com/api/users/register
thanks in advance.

Related

Getting internal error when trying to access website live

Getting 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 at webmaster#api.example.com.au 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.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
I pushed live codeigniter project, I updated .htaccess , database file, config file.
.htaccess file contains following code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]
Options -Indexes
The Codeigniter project is inside api.websiteName.com folder and it is not in public_html, if i remove the index.php and htccess file and upload "index.html" file for testing purpose , then index.html works fine but when I upload index.php and .htaccess files back , it says Internal server error 500, There are many answers for same question, I followed answers and did update .htaccess file but nothing works. Folder permissions set as 755 but still getting same error. Any help would be much appreciated.
PHP verison is higher than 5.6
You can try this .htaccess file in your code.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
<IfModule mod_headers.c>
Header add Access-Control-Allow-Origin "*"
</IfModule>
<IfModule mod_env.c>
SetEnv CI_ENV development
</IfModule>
I hope it will help you..

Internal Server Error in Production, but not in Local, and not on "/" route

A Slim (PHP microframework) app was developed. It works in localhost, but gets an error 500 in production. Here are the details:
It's fully working in local.
In production, the home route ("/") works, but all other routes throw an error 500.
If any specific route is put in the "/" route, it works.
The Slim site is hosted in a subdomain. A Wordpress site is hosted on the main domain.
It is hosted on a shared hosting by 1and1.
The exact error is:
Internal Server Error : The server encountered an internal error or
misconfiguration. Additionally, a 500 Internal Server Error error was
encountered while trying to use an ErrorDocument to handle the
request.
Several htaccess files were tried unsuccessfully.
Thank for your ideas to manage the issue!
You could try this one, it was working for an old project
<IfModule mod_rewrite.c>
# Activate this if you need to follow symlinks
#Options +FollowSymlinks
RewriteEngine On
# Explicitly disable rewriting for front controller
RewriteRule ^index.php - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [QSA,L]
</IfModule>
can you please try this .htaccess file instead?
# Redirect to front controller
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

.htaccess mod_rewrite 500 Internal Server Error

I succeeded to use .htaccess with mod_rewrite for my first domain name.
I try to use it for a second domaine name, and I have for result "Internal Server Error".
However, I put the same files on their server, and they have the same configuration.
The content of the .htaccess file :
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
Where can the problem come from ?
Best regards,
I found the solution, it's a problem with the encodage.
Getting Error 500 with this .htaccess on Linux, works fine on Windows

.htaccess show 404 error if url has more than two slashes in html page

I have html page created from htaccess.
Like this.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^/]*)/(.*\.html) process/?category=$1&link=$2 [L]
It's working fine.
It redirects url
www.site.com/software/page.html
To
www.site.com/process/index.php?category=software&link=page.html
I want to show 404 error if url has more than two slashes.
For example
www.site.com/software/page.html/page.html
or
www.site.com/software/software/page.html
Should show 404 error instead of redirected like this.
www.site.com/process/index.php?category=software&link=page.html/page.html
Currently I am doing this with php but I want to do it in .htaccess so as to give 404 error on first request.
Please see and suggest any way to do this.
Thanks
This code should run :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*/[^/]*/ dhddhdhdhdhdh [L]
RewriteRule ^([^/]*)/(.*\.html) process/?category=$1&link=$2 [L]

WAMP - Trailing Slash (/) Gives Error 500 "Internal Server Error" - .htaccess Error?

I use WAMP on my computer and when coding my website I decided to remove the .html extension in hopes of improving aesthetics.
This works fine, so, in my case, temp.jakegriffin.co.uk/index.html became /index which is what I wanted. Unfortunately, if there is a trailing / after index, I get:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin#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.
When I attempt to fix this in the .htaccess file, I either get the error 403 were I'm forbidden or the error 404 were the page does not exist.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
That is the code in my .htaccess file for the removal of the extension. If someone could help me, it would be greatly appreciated.
Thanks in advance,
Jake.
This this mod_rewrite rule:
* http://planetozh.com/blog/2004/05/apache-and-the-trailing-slash-problem/
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/
Try this:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.+)[\/*]$ $1.html [L,NC]
now you can add a bunch of forward slashes (/) after index ;)

Resources