permalinks in WordPress not working on localhost but work perfectly on live server

前端 未结 6 1636
猫巷女王i
猫巷女王i 2021-01-26 10:50

I am getting problem of permalink in WordPress not works at localhost but perfectly work at server.I am also word press developer and get these problem many times.Can you please

相关标签:
6条回答
  • 2021-01-26 11:20

    If you are using ubuntu system then you need to enable apache2 mod_rewrite for your setup. Try this command

    sudo a2enmod rewrite
    

    You will get message like below:

    Enabling module rewrite.
    To activate the new configuration, you need to run:
      service apache2 restart
    

    Now enter this command to restart your apache web-server.

    sudo service apache2 restart
    

    This should solve your problem. If the problem persist then you need to change apache config file (apache2.conf):

    $ sudo gedit /etc/apache2/apache2.conf
    

    Search for <directory> model for your localhost root directory path. Web-server root path may very based on your apache installed version. It might be <Directory /var/www/> or <Directory /var/www/html/>. Its mostly like following:

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory> 
    

    Change AllowOverride None to AllowOverride All. Save and close the file. Restart your apache web-server

    sudo service apache2 restart
    
    0 讨论(0)
  • 2021-01-26 11:22

    if you use Mac OSX you have

    sudo nano /etc/apache2/httpd.conf
    

    Search for the following string:

    #LoadModule rewrite_module libexec/apache2/mod_rewrite.so
    

    remove the ‘#’ sign

    Now, Search for

    <Directory />
        AllowOverride None
        Require all denied
    </Directory>
    

    and replace AllowOverride None for AllowOverride All

    Finally Search for the section Document Root and inside this section replace AllowOverride None for AllowOverride All

    0 讨论(0)
  • 2021-01-26 11:26

    Does your local server run Apache2? Have you enabled mod_rewrite? Because that is what you need to have permalinks working. Well it's one thing, after that's enabled restart apache2. Then check that your .htaccess file is configured properly. Do you have WordPress in a sub-folder, on a sub-domain?

    0 讨论(0)
  • 2021-01-26 11:31

    These are the things that I did to fix this.

    • change settings > permalink > select 'default' > save

    • Fix some php syntax error (please see apache error logs)

    • get the same .htaccess from the root directory of wordpress site you are migrating

    • in apache2.conf in Directory > add this > Allowoverride ALL

    0 讨论(0)
  • 2021-01-26 11:36

    If you are using WAMP on windows go to notification and click on the WAMP icon, Then go to Apache -> Apache Modules and check rewrite_module.

    Apache Modules-rewrite_module

    0 讨论(0)
  • 2021-01-26 11:37

    if you copy the wordpress instance from a server to your local machine, often you need to reset the permalinks. Just go to the permalinks settings screen and hit save. That usually does the trick for me.

    0 讨论(0)
提交回复
热议问题