0

i have the following code

Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteRule ^releases/([a-z]*)/$ releases.php?go=$1 [NC,L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ $1.php?%1 [NC,L,QSA]

The way i access this is

domain.com/subdir/releases/data

This how ever gets the redirect done but it breaks all the css images js etc.

Could anyone suggest an alternate. Thnx

and i want to include the condition to check if file is releases.php

RewriteCond %{REQUEST_FILENAME} ^/releases/(.*)$

would that work ? thnx

5
  • Use a RewriteCond to exclude css/etc. from rewriting. Or use <base href=> to reroute resource references in your html pages. Commented Jul 15, 2013 at 13:36
  • And what do you expect if you have unconditional RewriteRule ^releases/([a-z]*)/$ releases.php?go=$1 [NC,L,QSA]? Commented Jul 15, 2013 at 13:36
  • how exactly do i exclude all css and image formats in rewrite condition Commented Jul 15, 2013 at 13:37
  • well my condition would be only when the file name is releases.php...and its not a duplicate. ive checked it , didnt help Commented Jul 15, 2013 at 13:37
  • anyone any input is appreciated guys. Commented Jul 15, 2013 at 14:19

1 Answer 1

0

I suspect you are using relative paths. When doing rewrites I also suggest to use absolute URLs for js/css/images. I use absolute paths anyway but especially when using rewrites.

Use the full document path or use / in front of the files.

So if you have something like

<script src="yourscripts.js" type="text/javascript"></script>

Change it to this

<script src="/yourscripts.js" type="text/javascript"></script>

Or just use the full path to the file and that would work too.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.