.htaccess causes fail in parsing source maps - javascript

On the web page the .htaccess is:
RewriteEngine On
RewriteBase /
Options -MultiViews
DirectorySlash Off
# skip POST requests
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ /$1.php [L]
# redirect to .php-less link if requested directly
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.php\sHTTP/.+
RewriteRule ^(.+)\.php $1 [R=301,L]
Options All -Indexes
ErrorDocument 403 /img/error.php
ErrorDocument 404 /img/error.php
ErrorDocument 500 /img/500.png
It causes the next error:
Failed to parse SourceMap: .../js/bootstrap-select.js.map
When I delete it, the error doesn't occur.
How should I modify .htaccess?

Even though you had answered yourself just i want to post this so that others with this issue will know exactly what that happens
Warning:
Do not use .htaccess to redirect error to another HTML/PHP page or server
that isn't your own (such as this error.php). Errors can be replaced
by other images, not with an HTML or PHP page as that might cause indefinite
loop too.

Solved the problem by changing error.php to a picture ( in error.php there was redirect to index page ).

Related

Website keeps requesting a 301 URL address

My website is giving me a "This website is not secure" and I can't find the root of it, even though I double checked through everything to see if there are any http and switched them to https. I also have cloudflare forcing https.
I have checked the network tab and found one URL giving me trouble but it doesn't give me much information
The URL is giving a 301 moved permanently. I don't know where in my html I am requesting this site. I even used ctrl + f nothing showed up.
It's just requesting http://mywebsite.com/ but there is nothing I can see in my html requesting a http version of my site. I don't have anything that would cause my website to request http in .htaccess either.
RewriteEngine On
Options -Indexes
RewriteRule ^folder/?$ - [F]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
ErrorDocument 403 /index.html
ErrorDocument 404 /index.html
ErrorDocument 500 /index.html
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/403/$
RewriteRule ^(.*)$ /index.html [L]
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /index.html [L]
RewriteCond %{REQUEST_URI} ^/500/$
RewriteRule ^(.*)$ /index.html [L]
Is there something I'm missing?
I found the issue. It looks like it was jQuery that was requesting a http version of my site.
I couldn't ctrl + f it because it was a cloudflare jQuery link.
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
On line 2727 it was checking using http. (The picture shows https is because I just changed it)
The Fix
Save the jQuery locally and change http to https.

Problem when my React App is put on the web

I have created my React App, npm run build ... Put my file in filezilla,
but the problem is that I have this error
Not Found
The requested URL /main was not found on this server.
when I go to a page other than https://clickswinner.alwaysdata.net
What are you propose ?
Try creating a .htaccess file and put it at root of your server
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.html [L]
</IfModule>
Google is your friend
Here is an article about how to fix 404 issues for Filezilla
https://medium.com/#christine_tran/deploying-a-simple-react-application-using-ftp-filezilla-dreamhost-1e5ff6b8abd6

changed .htaccess and permalink now everything besides homepage 404s

I added this code to my .htaccess file to get rid of index.php, but now all the pages 404 (the hyperlinks are mapped to the correct url)
# 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
i set up my permalinks using http://1.1.1.1/%postname%/
what are the next steps in order to troubleshoot this issue?
can anyone provide me with a rewrite link and where that file may be located (I don't fully understand the other similar posts as they all wrote their own rewrite rules, where would I find that file?)
I have already installed monkeyman rewrite analyzer, but don't know where to start troubleshooting from there.
Any links or information is helpful, even if is not a direct solution to the problem, I will post my solution when completed.

In angular js after reloading page it say error on server 404 can not found the page after using $locationProvider.html5Mode(true);

I use
$locationProvider.html5Mode(true); to remove # from url
http://seagullinteractive.com/#/about :-its work after reload
to
http://seagullinteractive.com/about :- its not work dont now the problem
You need to create .htaccess file in your root directory.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
Need to put above rewrite rules. Then it will be fine. When you call http://seagullinteractive.com/about then your server will look for directory with name "about" which actually will not exist and you will get 404 as a result. You need to redirect to index.html(or whichever is your page that contains ng-app) if there is no resource found on server with requested URI.

default controller automatically added to url links in codeigniter

First my Codeigniter
Options -Indexes
Options +FollowSymLinks
Options -MultiViews
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(welcome(/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]
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
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>
Now everything works good on default route which is welcome.
After negativing to any other page, some JavaScripts won't load.
here is apache access log
Actual assets are in assets/core/
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/client.search.js?ver=1.0.2 HTTP/1.1" 404 1175
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/client.twitter.js?ver=1.0.2 HTTP/1.1" 404 1175
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/lib/md5.js? ver=1.0.2 HTTP/1.1" 404 1175
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/client.flickr.js?ver=1.0.2 HTTP/1.1" 404 1175
and if I change the default route to anyother page only that page will work perfect, but all other pages will have the same issue..
this /welcome/ is automatically added to the links, any help would be appreciated.

Categories