Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am having an issue with my permalink setup, which I think has to do with my setup, rewrite rules, and more.

Under Settings->Reading, we have a static Front Page set as well as a Posts page (Home and News, respectively). Under Settings->Permalinks, I have a custom one set up as /news/%postname%/.

Basically, I want my url to look like this for an article: http://www.company.com/news/a-news-article/. I want http://www.company.com/news/ to take me to my articles.

As of right now, this is 90% there. What I noticed is that if I go to http://www.company.com/news/not-a-post/, where not-a-post is not created, I get a 404. But, if I go to http://www.company.com/asdf, I would expect a 404. Instead, it loads the front page (the static front page).

For our setup, we are using the roots theme as a base, and not using htaccess, everything is in the httpd.conf. Our rewrite rules look like this:

RewriteRule ^/index\.php$ - [L]
RewriteRule ^/css/(.*) /wp-content/themes/thetheme/css/$1 [QSA,L]
RewriteRule ^/js/(.*) /wp-content/themes/thetheme/js/$1 [QSA,L]
RewriteRule ^/img/(.*) /wp-content/themes/thetheme/img/$1 [QSA,L]
RewriteRule ^/font/(.*) /wp-content/themes/thetheme/font/$1 [QSA,L]
RewriteRule ^/plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

When I enabled logging, it says that it sent it to index.php, which should be right. But why doesn't index.php handle this 404 correctly?

If I use the 'Day and Name' option from permalinks, everything looks and works right. It also appears that if I use /news/%year%/%monthnum%/%day%/%postname%/, it works as it should too. Why won't it work with just /news/%postname%/?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.