Tradebox 404 - File Not Found Sorry! Cannot seem to find the page you were looking for - 404-page

After I finished the my installation I got this error:
404 - File Not Found
Sorry! Cannot seem to find the page you were looking for.
I don’t know how to resolve this error. The .htaccess look like this:
# Disable directory browsing
Options All -Indexes
---------------------------------------------------------------------
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
ServerSignature Off

Related

.htaccess still showing .html extension

I am using cpanel.
In the public_html folder I have 2 files:
home.html
test.html
home.html links to test.html with:
Test
I do not want to display the .html extension in the browser.
My htaccess file is as follows, but the .html extension is still displayed:
# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^education\.mekan\-turk\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
Could you please try following, based on your shown samples. Trying to fix OP's attempts here. I am assuming that OP wants to hit URL like http://localhost:80/test which should be served by http://localhost:80/test.html here.
Fix is, when you are checking condition RewriteCond %{REQUEST_FILENAME}.html -f then while Rewriting rule you need NOT to mention .html else it will show it in browser. Also keeping your last 2 rules at top will help here.
# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ http://%{HTTP_HOST}/%{REQUEST_URI} [L]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^education\.mekan\-turk\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Fair warning I haven't tested it yet should work I believe.

removing .html with .htaccess gives 404 error

So I just figured out how to make my own custom 404 page and the 404 page works now.
I did all the .htaccess stuff for 404 page but now I am trying to remove the .html from the url.
I put in the code i found from the internet and i belive it worked, because now the .html is gone but i am getting a 404 error page. e.x domain.com/contact shows me my 404 error.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /error_404.html
ErrorDocument 404 /error_404.html
RemoveType x-mapp-php4 .html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
The bottom part where "RewriteCond" starts is the code for the removal of .html.
Try using this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule .* $0.html
RewriteRule (.*) /error_404.html
ErrorDocument 404 /error_404.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.html
RewriteRule ^/?(.*)\.html$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^/?(.*)$ /$1.html [L]
</IfModule>

How to add HTTPS via .htaccess file

I have installed an SSL on my website and I have a .htaccess file that has some conditions already written. I have looked at a number of methods shown online on how to force https. However, none of them seem to work. I keep having broken links.
The code I am currently using, the rule commented out does not work for https
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
#This condition doesn't seem to work
#RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect non www. to www.
#RewriteCond %{HTTP_HOST} !^www\.MYWEBSITE\.co\.uk
#RewriteRule (.*) http://www.MYWEBSITE.co.uk/$1 [R=301,L]
# Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1? [R=301,L]
# Remove .php ONLY if requested directly
RewriteCond %{THE_REQUEST} (\.php)
RewriteRule ^(.+)\.php /$1 [R=301,L,QSA]
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
If you would like to force HTTPS you can use the following:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

.htaccess Error 404 on index file

Good day,
I was wondering if you could help me.
I have a .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} =POST
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
ErrorDocument 404 http://scytech.co.za/Page-Not-Found/404
When i try to open http://admin.scytech.co.za it give me an error 404 but when i try to open http://admin.scytech.co.za/index it works 100%Could you please help me?
try this...
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

Url Rewriting - End of url - Removing character after .html

My htaccess:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^m/(.*)$ /$1 [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteRule products-([0-9]+).html$ products.php?page=$1 [NC]
RewriteRule services-([\-]?[0-9]+)-(.+).html$ services.php?id=$1 [NC]
RewriteRule objects-([\-]?[0-9]+)-(.+).html$ object.php?id=$1 [NC]
Wordpress Line
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I have an error.
if someone try domain .com/product-6-orange.html/something
he got a the same page as domain .com/product-6-orange.html
I dont want that domain .com/product-6-orange.html/something return a correct answer.
I want that
domain .com/product-6-orange.html/something redirect to domain .com/product-6-orange.html
so anything after .html need to be remove .
but how ??
I want that domain.com/product-6-orange.html/something redirect to domain .com/product-6-orange.html
Insert this redirect rule just below RewriteEngine on line:
RewriteRule ^(.+?\.html)/.*$ /$1 [NC,L,R=301]