htaccess的搜索引擎网址 [英] htaccess SEO URL

查看:100
本文介绍了htaccess的搜索引擎网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点难倒在这里。我一定是100多篇文章和帖子寻找一个解决方案。

我试图把这样的:

  sub.domain.org/folder/index.php?p=home
 

进入:

  sub.domain.org/folder/home/
 

下面

我的规则已经发展很多次,但几乎都不能正常工作。我不知道还有什么尝试。真的AP preciate一些帮助在这里。mod-rewrite启用,而且我托管自己的服务器。

 选项+了FollowSymLinks
RewriteEngine叙述上
重写规则^ /?文件夹/(.*)/$ /folder/index\.php?p=$1 [L]
 

解决方案

试试这个code。在 /folder/.htaccess

 选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上
的RewriteBase /文件夹/

的RewriteCond%{} THE_REQUEST /index\.php\?p=([^\s&]+)[NC]
重写规则^%1 /? [R = 301,L]

的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^(。+?)/?$的index.php?P = $ 1 [L,QSA]
 

I'm a bit stumped here. I must have been over 100 articles and posts searching for a solution for this.

I'm trying to turn this:

sub.domain.org/folder/index.php?p=home

Into:

sub.domain.org/folder/home/

My Rule below have evolved many times but almost everything does not work. I don't know what else to try. Would really appreciate some help here. Mod Rewrite is enabled, and I'm hosting my own server.

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/?folder/(.*)/$ /folder/index\.php?p=$1 [L]

解决方案

Try this code in /folder/.htaccess:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /folder/

RewriteCond %{THE_REQUEST} /index\.php\?p=([^\s&]+) [NC]
RewriteRule ^ %1/? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/?$ index.php?p=$1 [L,QSA]

这篇关于htaccess的搜索引擎网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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