3

I have a laravel installation at same domain.com. The site is up and running. I need to install a wordpress in blog folder at domain.com/blog. when I try to install the wordpress, it's not allowing me to run the installation and says "This webpage has a redirect loop" . I installed wordpress by using domain.com/blog/index.php, But after installation I was not able to run the wordpress blog from domain.com/blog/

I have provided relevant permissions to the wordpress blog folder.I will be managing wordpress from the blog admin and laravel site from laravel section.

I have seen https://laracasts.com/discuss/channels/general-discussion/install-wordpress-in-domaincomblog but could not make it work.

Mu working environment is : Xampp in Ubuntu

Any suggestions will be helpful.

3 Answers 3

2

I got a solution from laravel forum. Adding the line in the htaccess worked for me.

RewriteCond $1 !^(blog)

Blog is working properly as a separate folder.

Sign up to request clarification or add additional context in comments.

4 Comments

hi @RDB this worked for me but when I apply seo friendly urls for my wordpress blog like this website.co/blog/sample-post then it is not working, did you also face this kind of problem
<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteCond $1 !^(articles) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> This is my public/.htaccess code but it is not working.
where is you htaccess file, I did the same but it didn't worked.
SEO Friendly URLs are not working.can anyone help in this regard.
0

this line in .htaccess is probably your culprit:

RewriteRule .*/$ /$1 [L,R=301]

comment it out and see it that solves your problem.

This line forces everything in the public domain to go through laravel's router. You could probably leave it by writing another regex above that line looking specifically for the /blog directory, or rewrite that line to route anything that != your blog directory.

You should really leave that line there if possible.

2 Comments

thanks for the reply. removing RewriteRule .*/$ /$1 [L,R=301] is causing problem in the other section
Yes, you shouldn't remove it, I was just showing you that it is most likely causing your problem. You need to rewrite that rule, or add your own just before it such that it doesn't redirect when hitting /blog subdirectory
0

Add below lines in .htaccess

RewriteCond $1 !^(bmcblog)

 # Redirect Trailing Slashes...
 RewriteRule ^(.*)/$ /$1 [L,R=301]

It will look like this

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond $1 !^(bmcblog)
    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

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.