As noted above, that’s wrong on two levels, the $1 variable and the two directory levels for viewgallery.php to deal with for supporting files (css, js, gif, jpg, etc).
RewriteEngine On
RewriteRule ^viewgallery/([0-9]+)?$ viewgallery.php?cid=$1 [NC,L]
RewriteRule ^viewgallery/([0-9]+)?/$ viewgallery.php?cid=$1 [NC,L]
Is this correct… ?
Like you said… CSS file is missing…
To get around this seeming “bad feature” of mod_rewrite, you can use absolute links throughout your site instead of relative links OR use HTML’s <base> tag to identify the real location:
<head>
<!-- … other head tags withOUT relative links …–>
<base href=“http://www.example.com/display.php” />
<!-- … other head tags with relative links … –>
</head>
Note that an absolute link (with either a leading / to denote DocumentRoot OR the full URL) is required as you are trying to “fix” the problem with relative links.
I don’t understand this dklynn… so how do I display the page with CSS properties, my background… etc, etc…?
May be I should have asked this question before… Apache’s mod_rewrite does it change the links you see on the browser when a ‘next’ button is pressed for a picture on a website … does mod_rewrite change the link physically…?
We all start as a newbie … you’ll be an expert soon!
Correct? Vs what? Okay, I’m NOT a fan of trailing slashes (except for directories) so my vote is NO. Looking back, I didn’t refer you to the tutorial linked in my signature - go look for the section titled “Relative Links Are Missing!” and look at the options that you have when you won’t let the visitors’ browsers know what directory level they’re in (the trailing / changes that level).
Apache’s mod_rewrite DOES change the directory level. Your code shows that you use links to viewgallery/{id number} (first subdirectory level) AND viewgallery/{id number}/ (second subdirectory level) - obviously, viewgallery.php is in the DocumentRoot (zero subdirectory level). BECAUSE your redirection is not a 301 (which shows the redirection to the visitor’s browser), the visitor’s browser will be requesting links relative to either the first or second level subdirectory (unless <base> is used).