WordPress blog + Laravel with SEO friendly urls

I have a website with Laravel, I am starting a wordpress blog on the website with url.

http://abcd.com/blog

Read More

I have uploaded wordpress blog in the public directory of laravel. To exclude wordpress blog from laravel htaccess rules, I have added following line in my laravel htaccess

RewriteCond $1 !^(blog)

It works fine, but when I enabled SEO friendly urls for the blog to make urls as

http://abcd.com/blog/sample-post/

it gives internal error when I try to view a blog post.

Related posts

1 comment

  1. So long as you have the following two files, you should be just fine:

    DOCUMENT_ROOT/.htaccess (where the document root is your Laravel public directory):

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]
    

    DOCUMENT_ROOT/blog/.htaccess:

    RewriteEngine on
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]
    

    Of course, I’ve trimmed down the defaults – just showing what should be in each file.

    So, you don’t actually need to exclude the directory at all. That’s already done with RewriteCond %{REQUEST_FILENAME} !-d.

Comments are closed.