1

i was enabling clean urls by editing .htacces with the following code

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9]+)/(.+)/$ index.php?page=$1&option=$2 [L]
RewriteRule ^([a-zA-Z0-9]+)/(.+)$ index.php?page=$1&option=$2 [L]
RewriteRule ^([a-zA-Z0-9]+)$ index.php?page=$1 [L]
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1 [L]

i don't know much about .htaccess and did this much googling. My problem now is that i cannot load .js , .css and other files from my server. I am getting the 404 error page i made to show when requested page is not there

how can i make my css and js load??

2 Answers 2

2

create directory statics and put static file there.

/
|__ .htaccess
|__ statics
|  |__style.css
|  |__script.js
|__ some directory

edit your .htaccess like this:

RewriteEngine On
RewriteRule ^statics/ - [L,NC]

#your codes
Sign up to request clarification or add additional context in comments.

Comments

1

Be sure that your paths to your css/js/image files are relative to the domain instead of the page (e.g. use /yourdomain/styles.css instead of yourdomain/styles.css). Add a rewrite condition like this to your htaccess:

RewriteCond $1 !^(favicon\.ico|favicon\.png|media|robots\.txt|crossdomain\.xml|css|js)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.