简体   繁体   中英

Wordpress rewriting URL of a page

I'm currently creating a new Wordpress from scratch for a client who already has a website with a good SEO, and I have a question. I would like to use the former url for the new pages in wordpress, in order to keep the SEO, instead of the 301 redirection. For example I have the following page on the old site http://my-exemple.com/en/contact.php and on my wordpress I have : http://my-exemple.com/en/contact-php/

The dot is replaced by a - and there is a / at the end. How could I have the exact same url on wordpress ?

Thanks

You should simply edit the pages to /contact instead of contact.php .

With Wordpress, contact.php will look for a specific php file by that name. 301 redirecting the .php URL's to their non .php counterparts will not cause any harm to your SEO performance.

That said, if you really wanted to rewrite URLs to include the .php at the end, you could do this using the $wp_rewrite object in Wordpress.

It would look like this: $wp_rewrite-> page_structure = $wp_rewrite-> page_structure . '.php'; $wp_rewrite-> page_structure = $wp_rewrite-> page_structure . '.php';

Class Reference/WP Rewrite

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