nzdev
nzdev

Reputation: 334

something messy with .htaccess while using php include

I am currently working on a web application where i want to give user access to their profile by typing www.mysitename.com/username this is working fine with .htaccess but i also want the user to access other pages with clean urls by redirecting

http://www.mysitename.com/song-type-one.php?song=xyz to http://www.mysitename.com/song-type-one.php/song/xyz

i used the rewrite rule like this

RewriteRule ^(.*)$ ./song-type-one.php?song=$1 
RewriteRule ^lok-songs/(.*)$ .song-type-one.php?song=$1  

if i type the clean url now in the browser only my main content is loaded the css, javascript and my php include are not loaded. there might be something wrong with my .htaccess whats the best way to achieve all rules i want with .htaccess ?

Upvotes: 2

Views: 78

Answers (1)

endyourif
endyourif

Reputation: 2202

Try adding this before it:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

If the file exists on disk it won't do your rewrite rule allowing the JS and images to be loaded normally.

Upvotes: 2

Related Questions