-
Apr 1st, 2024, 10:56 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Problem loading images, scripts and styles after coding in htaccess file
I have addresses like the ones below that are all related to one product :
http://a.net/skins/them-black/p214-l...titlehere.html
http://a.net/skins/them-black/p214-l...elongtitlehere
http://a.net/longtitleherelongtitleh...titlehere.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 :
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ index.php?keys=$1 [NC,QSA]
in index.php i used this line in header too :
<base href="/">
and some commands for check parameters like as :
$params = explode( "/", $_GET['keys'] );
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)?
Point one: some fools still do not know the reason why cracked software should be used, companies or people who serve the terrorist or Zionist current must be fought, the current era is the era of soft war (the war of ideology and the battle of thoughts) is more important than hard war.
Point two: foolish thanks are worthless, I am here to shout out the faults so that they will be upset and stop their foolish pride, if you consider yourself strong, stop the death you are heading towards.
point third: some people or countries in the apocalypse era are just spectators, these are the most worthless creatures.
Point Four: NSA is one of the largest spy centers in the world : )) .
Point Five : Age is just a number, sometimes old people are stupider than young people.
-
Apr 2nd, 2024, 08:58 AM
#2
Re: Problem loading images, scripts and styles after coding in htaccess file
 Originally Posted by Black_Storm
... the reason is clear because it seems that all the requests go to the index.php ...
Correct. Right now you're turning all requests to index.php with the original request as a query string.
 Originally Posted by Black_Storm
... how can I solve this problem while I have also used the base commands in header and htaccess.
I would setup a RewriteCond so that it excludes your resources files. For example, assuming your file structure looks something like this:
+ /
+ images + javascript + css
Then you could add the following to your htaccess:
Code:
RewriteEngine on
RewriteBase /
# exclude requests to the resource directories
RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{REQUEST_URI} !^/javascript/
RewriteCond %{REQUEST_URI} !^/css/
# redirect all other requests to index.php
RewriteRule ^(.*)$ index.php?keys=$1 [NC,QSA]
-
Apr 3rd, 2024, 09:20 AM
#3
Thread Starter
Fanatic Member
Re: Problem loading images, scripts and styles after coding in htaccess file
thanks for help,i resolved my problem base on this codes :
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);
.
.
.
Point one: some fools still do not know the reason why cracked software should be used, companies or people who serve the terrorist or Zionist current must be fought, the current era is the era of soft war (the war of ideology and the battle of thoughts) is more important than hard war.
Point two: foolish thanks are worthless, I am here to shout out the faults so that they will be upset and stop their foolish pride, if you consider yourself strong, stop the death you are heading towards.
point third: some people or countries in the apocalypse era are just spectators, these are the most worthless creatures.
Point Four: NSA is one of the largest spy centers in the world : )) .
Point Five : Age is just a number, sometimes old people are stupider than young people.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|