assets not loading on local wamp server using PHP - javascript

I'm trying to run a system locally which is built using php. after doing all the configuration the system gets loaded and shown in the browser but all the assets related to UI components are not displayed. I tried different ways to solve it by changing permission in httpd.config file but still it doesn't work. I'm new to php can someone help me with this?
.htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(assets|css|js|paging|test|cronjobs|documents|SOAP|PDF|demo|pages|classes|UPLOADS|HTML|company_logo)/ - [L]
RewriteCond %{REQUEST_URI} !\.(css|jpg|gif|png|js|robots.txt)$ [NC]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?([^/]*)?$ index.php?&pageid=$1&id=$2&fm=$3&tpe=$4&curPage=$5&sortby=$6&sortbyodr=$7 [QSA,L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?([^/]*)?$ main.php?&pageid=$1&id=$2&fm=$3&tpe=$4&curPage=$5&sortby=$6 [QSA,L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?([^/]*)?$ index.php?&pageid=$1&id=$2&fm=$3&tpe=$4&curPage=$5 [QSA,L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/?([^/]*)?$ index.php?&pageid=$1&id=$2&fm=$3&tpe=$4 [QSA,L]
RewriteRule ^([^/]*)/([^/]*)/?([^/]*)?$ index.php?&pageid=$1&id=$2&fm=$3 [QSA,L]
RewriteRule ^([^/]*)/?([^/]*)?$ index.php?&pageid=$1&id=$2 [QSA,L]
RewriteRule ^([^/]*)?$ index.php?&pageid=$1 [QSA,L]

Related

Laravel 8 and running on the server

I have a problem with running Laravel 8 on the production server.
In the root directory I put the .httpacces file from the public directory and changed the name of the server.php file to index.php
Everything works except styles, js, and more
The contents of the .httpacces file
Options -MultiViews -Indexes
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
What do I have to change, add? Thank you very much for the hint.
You do not want to rename the server.php. Whether you are using Apache or nginx, make sure your Documents Root points to the public!! folder of your Laravel application. Never point it to the main directory. You can find configurations for nginx and apache online regarding laravel.

Codeigniter local to live CssJs//Boostrap error

I have just recently pushed my CodeIgniter project from local development to live using FTP, I have updated the config and database files also to match the base URL and database details.
immediately after loading can visually see the site but the styling involving the Css/Js/ and Boostrap are not working yet, I linked all using base URL before pushing the project live, I have tried everything but nothing seems to fix the problem, any suggestions?
.htacces file
RewriteEngine On
RewriteBase /test_abc/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ ./index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ ./index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^(index.php|images|css|fonts|js|robots.txt)

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

.htaccess file won't work on my node.js app

I have the following .htaccess file located in the root directory of my node.js app:
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]
My website runs at www.mywebsite.com. When a form is submitted, the page is redirected to a success page:
res.redirect("/success.html");
The problem is, my .htaccess file isn't working properly. I am redirected to www.mywebsite.com/success.html, instead of www.mywebsite.com/success.
I have tried changing my node.js script to:
res.redirect("/success");
But then I get an error page. What am I doing wrong?
.htaccess is only for Apache servers, but you can try something like this:
nodejs equivalent of this .htaccess

Search doesn't work on php file

I am testing some basic searching on tables without the use of database yet.
The problem is the search is working in the HTML file but failed to work on php file(I am using codeigniter framework).
This is the code on both html file:
<script src="js/search.js"></script>
THis is the code on my CI php VIEW file:
script type="text/javascript" src="application/views/ui/js/search.js">
My htaccess file on the views:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /webs/BCI/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
My base_url function works on my css files, but it just won't load my JS files located on my js folder.
Are there any more configurations needed to load a js file?
You have to store all css, js and image file under public_html folder. And call your file like-
<script src="<?php echo base_url(); ?>js/search.js"></script>

Categories