I have files present in FTP but when I'm trying to access those files (html files) I'm getting "The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
My .htaccess file code is this and I have tried some of the solutions but none worked. Can you please tell me what's wrong or missing in htaccess file.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /demosite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /demosite/index.php [L]
</IfModule>
# END WordPress
Related
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..
does anybody know how to setup Laravel that it´ll work on a shared Server based on Linux?
I´ve tried default and alternative .htaccess files:
when I type a url which doesn´t exists and isn´t defined in routes.php I get this:
.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, 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.
when I type a url to a folder which exists but isn´t defined in routes.php I get a Redirect Loop
when I type a url to a file which exists but isn´t defined in routes.php I get same Error like first one
here the .htaccess files I´ve tried with (both behave same)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I have some domain for example http://domain.com
http://domain.com/sport -> Folder actually exits
http://domain.com/sport/123/ - > Folder dont exist
http://domain.com/sport/123/hello.html - > file dont exist
So when http://domain.com/sport/123/ or
http://domain.com/sport/123/hello.html is visited..Instead of throwing not found error it must show the content of the first folders index.php , that is in this example it must show the contents of http://domain.com/sport/index.php
I tried below code.but it throws 500 internal error
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/.*$ /$1/index.php [L]
Do you still get a 500 internal server error if you wrap all of your rewrite rules inside an IfModule container? E.G.
<IfModule mod_rewrite.c>
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/.*$ /$1/index.php [L]
</IfModule>
If you stop getting the error, but rewriting is still not working, that means you have to turn on the rewrite module. How this is done is entirely dependent on your setup, your hosting services setup, and/or whether you have access to the httpd.conf file.
I have a website built on codeigniter and am trying to get the PP IPN working with it. I have looked at a few CI specific libraries, but want to have a stand alone IPN file.
Basically, I have CI installed in the website root and I have another directory 'pp', also in the root.
I'm trying to test the IPN using Paypal's sandbox, but it's returning a 404, I also can't access the file directly.
Here is my .htaccess file:
XSendFile on
Options -Indexes
Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
RewriteRule ^(index(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
RewriteCond %{HTTP_HOST} !^(www) [NC]
RewriteRule ^(.*)$ http://www.mysite.net/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|pp|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
Here's hoping it's something really obvious!
Thanks,
Ryan
If the pp directory exists, you could just put an htaccess file in that directory and just have:
RewriteEngine On
in it by itself, and any rules in the main htaccess file would get ignored. If your paypal stuff already has rewrite rules in an htaccess file in the pp directory, you may want to look into those rules as the cause of the 404.
Do you have mod_rewrite.c enabled. If not, that .htaccess will always give 404. (Sorry I couldn't make this a comment, don't have the rep).
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /homepage/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /homepage/index.php [L]
</IfModule>
That is my .htaccess code. I have created new file in homepage/test.php and when i visit it from browser it give error of access,
i have tried by replacing index.php with test.php but it still not working.
Can some one explain me how this code work and why not my code is working.
i have deleted .htaccess but its still not working. What else file it can be.
Change
RewriteRule . /homepage/index.php [L]
to:
RewriteRule (.+) /homepage/index.php?page=$1 [L]
P.S. For this to work, your index.php needs to listen for $_GET['page'] and load the appropriate resource.
EDIT: without using the "?page=$1" your code will just display the index page for all requests that are not files or directories. I am not sure if that is what your were going for.