我怎样才能使URL搜索引擎友好? [英] How can I make the URL search engine friendly?

查看:161
本文介绍了我怎样才能使URL搜索引擎友好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想cahange mysite.com/profile.php到mysite.com/profile

I want to cahange mysite.com/profile.php into mysite.com/profile

我写的htacess文件

I wrote the htacess file as

RewriteEngine On 

RewriteRule ^profile/?$ profile.php [NC,L]

和放置在根目录下。它不工作。我用的是Apache服务器。什么是错我的程序?

and placed in root directory. It doesn't work. I use the apache server. What is wrong with my program?

推荐答案

尝试这样的事情,而不是:

Try something like this instead:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

这样,你没有做到这一点对每个单独的URL。

That way you dont have to do it for each individual URL.

信贷

这篇关于我怎样才能使URL搜索引擎友好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆