WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

zh-cn:设置 固定链接页面

设置 → 固定链接

WordPress 前台的页面 URL 默认是由问号和一些数字组成的,但 WordPress 允许您自定义这些 URL 结构。设置固定链接,可以增强美感、可用性,以及您链接的向前兼容性。

性能提示:与日期和文章名月份和文章名%post_id%-%postname% 相比,由 %category%、%tag%、%author%,或 %postname% 开头的固定链接在解析时会耗费更多服务器资源。

关于设置固定链接的更多详情,参见使用固定链接一文。若您希望了解固定链接,请浏览《漂亮的固定链接》。

设置 固定链接页面


返回Administration Screens

Customize Permalink Structure

A number of tags are available, and here are some examples to get you started.

Common settings 
Check one of the radio buttons corresponding to the correct Permalink Structure for your blog.
  • Default - An example of the default structure is http://www.sample.com/?p=123
  • Day and name - An example of the day and name based structure is http://www.sample.com/2008/03/31/sample-post/
  • Month and name - An example of the monthe and name based structure is http://www.sample.com/2008/03/sample-post/
  • Numeric - An example of the numeric structure is http://www.sample.com/archives/123
  • Custom structure - In the box specify the custom structure you desire to use. One example is /archives/%year%/%monthnum%/%day%/%postname%/. Look at the Using Permalinks article for further discussion of Permalink Structure Tags.
Optional 
You may enter custom bases for your category and tag URLs here. For example, using /topics/ as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used. Again, see the Using Permalinks article for further discussion of Permalink Structure Tags.
  • Category base - Enter a custom prefix for your category URLs here.
  • Tag base - Enter a custom prefix for your tag URLs here.

Save Changes

Click the Save Changes button to ensure any changes you have made to your Settings are saved to your database. Once you click the button, a confirmation text box will appear at the top of the page telling you your settings have been saved. After you've clicked this button, you should receive one of two messages depending on whether your .htaccess file is writeable. For information on how to make .htaccess writeable, see Changing File Permissions.
  • If .htaccess is writeable, you will get a message that says "Permalink structure updated." You're all set; WordPress has been able to do everything for you automatically.
  • If .htaccess is not writeable, you will see a message at the top of the screen that says "You should update your .htaccess now.". Near the bottom of the screen you will see "If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all." This means you'll have to do one extra step yourself. In the text box at the bottom of the Screen, WordPress displays several lines of rewrite rules associated with the Permalink Structure you designated above. You need to manually copy everything in this text box into your .htaccess file to make your new Permalinks work.
Note: If you're writing your .htaccess file on your own local computer, remember, some operating systems do not allow the creation of a file named ".htaccess" because of the initial dot ("."). You can always name the file without the initial dot or with a standard extension (e.g. "htaccess.txt"). Once the file is uploaded to your weblog's directory, rename it with your FTP software. Most FTP Clients should provide you a way to rename filesthis.
Also Note: Files that begin with a dot (".") like ".htaccess" are hidden on most servers by default. Consult the userguide or FAQ of the FTP software you use to find out how to have the software display these hidden files, and also how to use the software to change file permissions, rename files, etc. For more information on all of this see Changing File Permissions.

Changelog

  • 2.3 : Added Tag base setting to Optional.
参见管理页面站点网络管理页面
本文已被标记为未完成状态。您可以将其补充或翻译完整,以此帮助完善 Codex。