久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 htaccess 創(chuàng)建 SEO 友好的 url

Creating SEO friendly urls using htaccess(使用 htaccess 創(chuàng)建 SEO 友好的 url)
本文介紹了使用 htaccess 創(chuàng)建 SEO 友好的 url的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試重寫站點的 url,我應(yīng)該提到 index.php 現(xiàn)在的工作方式是獲取 p(頁面)參數(shù)并包含適當(dāng)?shù)奈募?

I am trying to rewrite the urls of a site, i should mention that the way index.php works now is getting the p (page) parameter and including the appropriate file.

所以請求一個頁面是這樣的:

So requesting a page is like this:

www.domain.com/index.php?p=home
www.domain.com/index.php?p=search
www.domain.com/index.php?p=profile
www.domain.com/index.php?p=contact

我找到了如何為此創(chuàng)建重寫規(guī)則:

I found how to create a rewrite rule for this:

RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?p=$1

所以現(xiàn)在www.domain.com/home會給我主頁

但我還需要為此提供一個友好的網(wǎng)址

But i also need to have a friendly url for this

www.domain.com/index.php?p=profile&id=20

to

www.domain.com/profile/20/profile-friendly-name

or better

www.domain.com/profile/profile-friendly-name

*個人資料友好名稱是指公司名稱

*The profile-friendly-name refers to a company name

要求:

  1. 為所有頁面提供友好的 url,例如/home,/contact

  1. To have friendly urls for all pages e.g. /home, /contact

為個人資料頁面提供一個特別友好的網(wǎng)址,其中包含網(wǎng)址中的個人資料名稱

To have a particular friendly url for the profile page with the profile name in the url

我的問題:

  1. 如何使用現(xiàn)有的 url 格式 (index.php?p=profile&id=20) 向 url 添加個人資料友好名稱?

  1. How can i add a profile-friendly-name to the url with the existing url format (index.php?p=profile&id=20)?

我可以在那里只有一個唯一的名字嗎(沒有 id),就像我的最后一個例如?

Can i only have a unique name there (without the id), like my last example?

如果我設(shè)法做到了,我是否必須更改所有現(xiàn)有的網(wǎng)址在站點內(nèi)(鏈接、圖像 url、文件)到友好的格式?

If i manage to do that, will i have to change ALL the existing urls within the site (links, urls to images, to files) to the friendly format?

我注意到在應(yīng)用第一個 RewriteRule 之后,一些 css不包括樣式表和 js.怎么了?

I noticed that after applying the first RewriteRule some css stylesheets and js are not included. What is wrong?

推薦答案

RewriteRule ^profile/([0-9]+)/([A-Za-z0-9-]+)/?$ index.php?p=profile&id=$1

應(yīng)該適用于:

www.domain.com/index.php?p=profile&id=20

to

www.domain.com/profile/20/profile-friendly-name

這篇關(guān)于使用 htaccess 創(chuàng)建 SEO 友好的 url的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應(yīng)用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發(fā)技術(shù)
Having a single entry point to a website. Bad? Good? Non-issue?(有一個網(wǎng)站的單一入口點.壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務(wù)層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 国产在线观看福利 | 99re热精品视频 | 91国产视频在线 | 国产二区视频 | 久久久美女 | 亚洲精品视频一区二区三区 | 国内毛片毛片毛片毛片 | 日韩欧美中文 | 久久久毛片 | 久久久久久久97 | 久久爱黑人激情av摘花 | 99久久精品国产一区二区三区 | 亚洲一区在线日韩在线深爱 | 最新中文字幕在线播放 | 亚洲三级在线观看 | 男人的天堂中文字幕 | av色站| 国产精品国产三级国产aⅴ原创 | 国产亚洲精品区 | 四虎在线视频 | 久久综合一区 | 亚洲 中文 欧美 日韩 在线观看 | 国产在线精品一区二区 | 午夜视频一区 | 久久久久久久久久一区二区 | 免费在线观看一区二区 | 欧美精品一区二区三区在线播放 | 久久99精品视频 | 国产999精品久久久久久绿帽 | 美国av毛片| 黄a在线观看| jizz亚洲人 | 久久久久久国产精品免费免费狐狸 | 成人在线免费 | av网站在线播放 | 不卡的av电影 | 国产日韩欧美精品一区二区三区 | 日本黄色免费大片 | 亚洲综合色视频在线观看 | 亚洲国产成人在线 | 欧美日韩在线一区二区三区 |