Solved Problem loading images, scripts and styles after coding in htaccess file

Solved issue

persi

New Member
Joined
Apr 2, 2024
Messages
3
Reaction score
2
Credits
41
Hi,first sorry for my language , i have to use google translate for ask questions.

I have addresses like the ones below that are all related to one product :

http://a.net/skins/them-black/p214-longtitleherelongtitleherelongtitleherelongtitleherelongtitlehere.html
http://a.net/skins/them-black/p214-longtitleherelongtitleherelongtitleherelongtitleherelongtitlehere
http://a.net/longtitleherelongtitleherelongtitleherelongtitleherelongtitlehere.html
http://a.net/skins/them-black/p214
http://a.net/them-black/p214
http://a.net/them-black
http://a.net/p214
http://a.net/skins

I wanted to write a code to process all of them, I used the following method in htaccess file :

Code:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ index.php?keys=$1 [NC,QSA]
# or RewriteRule ^(.*)$ index.php/$1 [NC,QSA]

in index.php i used this line in header too :
Code:
<base href="/">
and some commands for check parameters like as :

Code:
$params = explode( "/", $_GET['keys'] );

problem :

but still my images, styles and script files are not loaded , the reason is clear because it seems that all the requests go to the index.php , how can I solve this problem while I have also used the base commands in header and htaccess.

If I need to write a better code, what code can cover that example without causing problems in loading the resources files (css,images,js files)?
 
Last edited:


solved :

htaccess :

Code:
RewriteEngine on
RewriteBase /

<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

php :
Code:
$url=urldecode(ltrim($_SERVER['REQUEST_URI'],'/'));
$param = explode( "/", $url);
.
.
.
 

Members online


Latest posts

Top