Forum Moderators: phranque
This is so that all posts can be viewed as "http://mydomain.com/name-of-post"
I want to be able to add another rewrite rule that loads a PHP file if someone goes to [mydomain.com...] So, I tried adding this right after the RewriteBase /:
RewriteRule ^content/(.+)$ /lib/content.php?desc=$1
I get a 404 error when doing this. Any ideas how can I get both to cooperate?
Thanks
I was thinking something like this:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/content/(.*)$
RewriteRule ^content/(.+)$ /lib/content.php?desc=$1
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
My conditional syntax doesn't seem to work. Can someone help me with this?
The additional RewriteCond is redundant, since the new RewriteRule requires the URL-path to start with /content.
As long as the /content rule precedes the WP rule and has an [L] flag, this code should work.
Jim
RewriteEngine On
RewriteRule ^content/(.+)$ /lib/content.php?desc=$1 [L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php [L]
# END WordPress
If I get rid of the Wordpress code, it works fine. So it doesn't like the both together for some reason.
Thanks