Current Location: Home> Latest Articles> Discuz! Homepage Optimization: Remove index.php from URL for Better SEO

Discuz! Homepage Optimization: Remove index.php from URL for Better SEO

M66 2025-07-18

Discuz! Homepage Optimization: Remove index.php from URL

In the process of website optimization, improving URL structure is a crucial aspect for enhancing both SEO performance and user experience. For Discuz! (DZ) forums, removing index.php from the URL is a common optimization practice. This makes the URL simpler and more SEO-friendly, improving both search engine crawling and user access experience.

Modify Site Settings

First, log in to the Discuz! admin panel, go to “Global -> Settings -> Site Information,” and under “Access Path Settings,” locate the “Homepage Filename” field. Delete index.php from this field and leave it blank. After saving the settings, Discuz! will automatically update the URL structure and remove index.php.

Modify Nginx Configuration

If you are using an Nginx server, you need to edit the Nginx configuration file. The configuration file is usually located in the /etc/nginx/sites-available/ directory. Open this file and add the following code:

location / {

Save the file and restart the Nginx service for the changes to take effect. This code ensures that all requests are redirected to index.php, removing index.php from the URL.

Modify Apache .htaccess File

If you're using Apache, you can remove index.php by modifying the .htaccess file. Create the .htaccess file in your website's root directory (if it doesn't already exist), and add the following code:

<IfModule mod_rewrite.c>

Save the file and make sure that the Apache server has mod_rewrite enabled. This configuration will redirect all requests to index.php and remove index.php from the URL.

Clear Cache

After completing the above modifications, you may need to clear your browser cache and Discuz! cache to ensure the changes take effect.

By following these steps, you can easily optimize the Discuz! homepage and remove index.php from the URL, improving the user experience and enhancing SEO performance. We hope these instructions help you optimize your site!