5
votes

I have installed WordPress on my local machine(Centos 7). It worked well without pretty URL.

What I tried to get it work:

  1. set Allowoverride All in /etc/httpd/conf/httpd.con under line and restarted the httpd service.

  2. Created .htaccess file in WordPress directory with following line of code:

   <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /rakesh/index.php [L]
   </IfModule>
  1. Set permalinks to post name in WP backend settings > permalinks

As a result i get "Not Found

The requested URL /index.php was not found on this server."

  1. I also tried to change permission on .htaccess file 777 and assigned to it Apache user by following command
   sudo chown apache /var/www/html/wordpress/.htaccess
   sudo chmod 777/var/www/html/wordpress/.htaccess

.

3

3 Answers

-4
votes

Make sure you have actually enabled mod_rewrite. At your terminal prompt, enter the following:

sudo a2enmod rewrite

and restart the apache

sudo service apache2 restart
1
votes

for wamp or xampp find the file httpd.conf. Open that in a text editor. Use the search facility in the editor to find "rewrite". The line you need looks like this:

#LoadModule rewrite_module modules/mod_rewrite.so

You need to take away the hash sign so it looks like this

LoadModule rewrite_module modules/mod_rewrite.so

Now just save the file.

1
votes

The LoadModule directives are in /etc/httpd/conf.modules.d/00-base.conf on CentOS 7.

It looks like:

LoadModule rewrite_module modules/mod_rewrite.so