Zhimeng DEDECMS optimizes the file storage location and naming rules using $ pai_arcdir

Source: Internet
Author: User

All users who use dede to build websites know that the shorter the document path, the better. I believe many users know how to modify it. There are also many articles for reference.

I will add some content here early this morning.

You can use $ cfg_arcdir to automatically modify the path. No tutorials have been found on the Internet. Therefore, you can find the following methods:

To reduce the trouble in the future, we recommend that you save the document in a single folder instead of under the document section.

For example, a document with a Document ID of 1

There can be two forms

1. http://www.xxxxx.com/mulu/1.html

2. http://www.xxxxx.com/html/1.html

Mulu is the topic folder of the document.

If you move this document later, the path will be changed, which has a great impact on SEO.

Therefore, we recommend that you save the document in a folder in the form of 2.

How to implement it?

Let's start the lecture now.

There are many methods, and there are also many tutorials on the Internet. I am talking about the methods I use.

Modify: common. inc. php

Find the default naming rule of the document.

Changed to the following format:

// Default naming rules for the document

$ Export _arcdir = str_replace ("/", "", $ export _arcdir); // remove the default HTML save path: "/" in the file to prevent errors

$ Art_shortname = $ pai_df_ext = '.html ';

$ Export _df_namerule = $ export _arcdir. '/{aid}'. $ export _df_ext; // call the above path for convenient management.

Note: $ cfg_arcdir can be directly set in the background.

The advantage of this method is that if you want to change the path in the future, you can directly modify the path in the background without changing the code again, which is more convenient.

Of course, you also need to modify the quick topic creation process based on the above ideas.

Reference code for quick topic creation:

<Input name = "namerule" type = "text" id = "namerule" value = "<? Php echo str_replace ("/", "", $ pai_arcdir);?> /Define aid).html "size =" 40 "/>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.