简体   繁体   中英

Wordpress rewrite url to index.php

Inside my .htaccess file, my default code is like this:

# 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

What I want to do is when I open mydomain.com it will redirect me to mydomain.com/?page_id=2 (but the url remain as mydomain.com ). How should I do that?

Please put this in your .HTACCESS file:

RewriteEngine On

RewriteRule ^$ /?page_id=2 [L]

EDIT:

Also you can set this from your Wordpress administration page: Go to Settings -> Reading and at "Front page displays" set as "A static page (select below)" and select from the dropdown list of "Front page:" your page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM