简体   繁体   中英

Change url to article in Cakephp

I create a new website. In the old one I had the url to an article like:

www.mysite.com/article,{article_id},{article_title}.html 

I want to change the structure of my url in cakephp without losing my SEO position in google. How can I do it?

I use Cakephp 3.8 I haven't tried anything yet because I don't know where to start

Assuming you are using an apache webserver, I'd set 301 redirects in the htaccess to tell the robot the old URLs are moved permanentely .

This shouldn't affect SEO as it is a standard procedure.

Depending on how your new URL format looks like, you can then use a query-string for dynamic urls like so:

RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} !^article,.+ [NC]
RewriteRule ^(.+?)/([^/]+)/?$ $1/?article,$2 [L,QSA]

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