0

I want to make a custom url like this http://example.com/entertainment/celebrity/call_me_caitlyn_breaks_the_internet

And i wrote the rewrite rule as follows

RewriteRule ^entertainment/celebrity/(.*?)$ index.php?/news_article/$1 [L]

As well as

RewriteRule ^entertainment/celebrity/(.*?)$ index.php?/news_article/celebrity/$1 [L]

Does not work both of them. How to fix this.

0

Here ya go, bruva:

RewriteRule ^entertainment/celebrity/(.+)$ news_article/celebrity/$1 [L,R=301]

That should do the trick. Please report back if it works.

Edit

Add QSA to the rule flags if you have query strings!

2
  • Still not work. Jul 1 '15 at 4:59
  • Works on one of my development servers (I'll double check in about an hour). It needs to be after your index.php rewrite rules. Can you edit your question and post your entire htaccess file?
    – jrothafer
    Jul 1 '15 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.