RewriteCond Mod_rewrite.c Question
-
Question:
How do I exclude everything in one particular directory directory being rewritten by mod_rewrite. I assume I need a RewriteCond. However I can’t get it to work.Background:
I have sucessfully setup my wordpress and basic permalinks. I’m using pages quite heavily, including images, links to pdf documents etc. in these pages. I have placed all my images and pdfs in a directory called content (eg. https://www.mysite.com/content/).When refering to my ‘content’ from pages I want to be able to use a simple URI in the a href tag. Somthing like
./content/picture.jpg
rather than hardcoding the full urlwww.mysite.com/content/picture.jpg
or navigating up an undertermined number of directories eg../../../content/picture.jpg
Once I turned permalinks on links such as
href='./content/images/pdf.jpg'
get translated into:https://www.mysite.com/about-me/docs/content/images/pdf.jpg
. I assume this is because mod_rewrite is rewriting the base for these links. I would like it not to re_write this beacuse it’s in the directory ‘content’ and it should resolve aswww.mysite.com/content/images/pdf.jpg
Any help would be appreaciated, Thanks.
.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
- The topic ‘RewriteCond Mod_rewrite.c Question’ is closed to new replies.