1

I have put my wordpress in public/blog folder in laravel. In my case after putting this RewriteCond $1 !^(blog) into .htaccess file I can install and access wordpress through www.mysite.com/blog. The only problem is when I change permalinks from this /blog/?p=123 to this /blog/%postname%/. It gives me error in laravel

NotFoundHttpException in RouteCollection.php line 161

so how can I have post with nice path like www.mysite.com/blog/my-post?

2
  • 1
    It'd be better to use a subdomain for that. Commented Mar 19, 2017 at 17:27
  • but I don't want to use sub domain Commented Mar 19, 2017 at 17:28

1 Answer 1

2

Just setting RewriteCond $1 !^(blog) is not enough.

Replace the line with RewriteCond %{REQUEST_URI} !^/blog/, so it'll ignore all URIs that start with /blog/.

Then don't forget to change the WP .htaccess too:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/   #change here
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /blog/index.php [L] #change here
</IfModule>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.