
Originally Posted by
dklynn
OMG!
First, DD, without an R=301 flag in your redirection, you HAVE changed the perceived directory level to articles/, NOT your DocumentRoot!
That would explain A LOT of the problems I have been having!!
So what is the exact syntax??
Current mod_rewrite
Code:
#PRETTY: articles/postage-meters-can-save-you-money
#UGLY: article.php?title=postage-meters-can-save-you-money
RewriteRule articles/([a-zA-Z0-9_-]+)$ article.php?title=$1
Possible new mod_rewrite???
Code:
#PRETTY: articles/postage-meters-can-save-you-money
#UGLY: article.php?title=postage-meters-can-save-you-money
RewriteRule articles/([a-zA-Z0-9_-]+)$ article.php?title=$1 [R=301]
Second, you are NOT using absolute links for your css (as Dan has told you) because all you need is
Code:
<link rel="stylesheet" href="/styles.css" />
Same treatment required for images, js, etc. BECAUSE the browser is requesting them from the articles/ directory, not from your DocumentRoot (which the http protocol accesses).
Regards,
DK
Well, I *thought* I fixed things - even with my retarded articles/ issue by doing this...
article.php
Code:
<!-- Page Stylesheets -->
<link type="text/css" rel="stylesheet" href="<?php echo WEB_ROOT; ?>css/main.css" />
<link type="text/css" rel="stylesheet" href="<?php echo WEB_ROOT; ?>css/dropdown.css" />
<link type="text/css" rel="stylesheet" href="<?php echo WEB_ROOT; ?>css/components.css" />
<link type="text/css" rel="stylesheet" href="<?php echo WEB_ROOT; ?>css/article.css" />
config.inc.php
Code:
<?php
define('ENVIRONMENT', 'development');
// define('ENVIRONMENT', 'production');
// Web Server Root
define('WEB_ROOT', ENVIRONMENT === 'development'
? 'http://localhost/01_MyProject/'
: 'http://www.MySite.com/');
?>
However I have discovered that the images in my articles are now not working because they have paths like:
h t t p: //localhost/01_MyProject/articles/%3C?php%20echo%20ROOT;%20?%3Eimages/some_image.jpg
So even with my WEB_ROOT, things won't work. 
If you can clarify that R=301, maybe I can get my images working too?!
Thanks,
Debbie
Bookmarks