Semantic URL with .htaccess (Error 500) - php

I want to semantic my website URL, but when I want to show result I have a 500 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 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.
Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80
The .htaccess code
RewriteEngine on
RewriteCond %{REQUEST_URI} 10/
RewriteRule 10/ http://localhost/Cnxkhamsat/admin/edit.php?chi_id=10
Any help ?

The code appears to work fine when trying on a local machine, meaning there are no syntax errors.
The most likely scenario is that you do not have the appropriate permissions to use the RewriteEngine. This usually happens when using a shared hosting, or sometimes VPS.
If you have access to your httpd.conf file you can most likely turn the RewriteEngine on from there. If you don't have access to it, then you'll likely need to contact your hosting provider and tell them that you need them to allow you to use the rewrite engine.

Related

I have codeigniter in subdirectory and wordpress installed on root directory of my server

If i try to access www.wordpress.com/codeigniter it is getting redirected to www.wordpress.com/en/codeigniter. If i change rewriterule in the .htaccess of wordpress to
RewriteRule ^(.*/)?codeigniter/(.*) /codeigniter/$1 [L]
Getting 500 internal server error. The server encountered an
internal error or misconfiguration and was unable to complete your
request.
Please contact the server administrator, webmaster#domain.com 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.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
Help me out to get this done please, Thanks in advance.

slim rest api work fine on localhost but it returning error 500 on shared hosting?

I have developed an application using angualar and php with slim and it works fine in localhost , but slim rest api showing error code 500 on shared hosting, How to solve this issue ?
when i try to check it showing below message
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, webmaster#demoems.aaaaa.com
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.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
If you are using Apache
you must create .htaccess file with this configuration
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
Also you must config your shared hosting apache config file
Find var/www/ Block
and change
this
AllowOverride none
To
AllowOverride All
problem solved by setting folder ,file permission to 755,644

Internal Server Error: Having trouble with mod_rewrite in .htaccess

My URL is like this:
http://example.com/Folder/index.php?city=Berlin&id=1
I want to turn it into:
http://example.com/Berlin/1
Using Generate It! I get this code:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /Folder/index.php?city=$1&id=$2 [L]
But when adding this in my .htaccess file and trying to open http://example.com/Berlin/1 I'm getting the 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, [no address given] 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.14 (Ubuntu) Server at example.com Port 80
What am I doing wrong? I'm trying since hours to get it work, but without success.
I found the solution:
I'm using this in my .htaccess:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/id/([^/]*)$ /Folder/index.php?city=$1&title=$2&id=$3 [L]
to change this link:
http://example.com/Folder/index.php?id=566&city=Berlin&title=this_is_the_websites_title
to:
http://example.com/Berlin/this_is_the_websites_title/id/566

creating htaccess undisplay my folder.. How to solve this?

in my htaccess file i have the following contents..
Options +FollowSymLinks
RewriteEngine On
Options -Indexes
when i am enabling this htaccess file my project directory is not showing in localhost :(
http://localhost/MyStartUp/OurProDeal/admin/ - showing internal server error and http://localhost/MyStartUp/OurProDeal/ not showing admin directory.
this htaccess file is working fine in my other machine.... any help
Error i am getting
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.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80

How to - Custom 404 Not Found php

I was looking for this over google and found just one thing repeated on every single website.
Edit your .htaccess and add this line:
ErrorDocument 404 /yourpage.php
So for example my page is error.php so it is obvious that it should be:
ErrorDocument 404 /error.php
However even if I type full domain name it doesnt works. It gives me Internal Server Error only and I have no ideas how to make it.
Any tips? Thanks.
EDIT No.1:
I am not quite sure where do I check for these "Apache" logs.
Btw here is full ISE Message:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, *webmaster#mydomainname.com* 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.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Also I have tried making error.html and doesnt works. And also I Do not use any other rewrites in htaccess.
Then your webserver does not support this option...
Look into your http.conf and search for
AllowOverride <value>
If it is not equal FileInfo or all configuring error documents is not allowed.
Change it to All to make it work (and restart Apache afterwards)
If you do not have access to the http.conf, ask your Provider to allow custom error documents.

Categories