Wordpress: When I click in the blog link then it redirect me to home page

I have a website www.xyz.com and in that I have a link Blog.

When user click on Blog link, then user is redirected to www.xyz.com/wordpress.

Inside www.xyz.com/wordpress i have several blogs links, but when I click on any blog link it throws "The requested URL was not found on this server."

Below is .htaccess file

 RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]

Anybody knows what wrong I am doing here.

Upvotes: 0

Views: 340

Answers (3)

I solve the above issue by updating xyz.com.conf file with below codes:

<Directory /var/www/html/wordpress>
        Require all granted
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?/$1 [L]
</Directory>

<VirtualHost *:80>

ServerAdmin [email protected]
ServerName xyz.com
ServerAlias www.xyz.com
DocumentRoot /var/www/html/wordpress

ErrorLog ${APACHE_LOG_DIR}/xyz.com_error.log
CustomLog ${APACHE_LOG_DIR}/xyz.com_access.log combined
        <Directory /var/www/html/wordpress>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>

</VirtualHost>

Upvotes: 0

Saeed Jamali
Saeed Jamali

Reputation: 1195

Your .htaccess file does't have any problem. it's better to check theme php codes to make sure if the link redirects to homepage there or not. when you check that code, it should be like below:

<a href="<?php echo the_permalink() ?>">
// your post content
</a>

Upvotes: 0

Krupal Panchal
Krupal Panchal

Reputation: 1545

Try with the default .htaccess and check.

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

# END WordPress

Upvotes: 1

Related Questions