没有名称的SEF网址,带有核心php和.htaccess [英] SEF url without name with core php and .htaccess
问题描述
我要设置SEF url,因为我也想从url中删除文件名. 我的网站位于核心php中,我设法从url中删除了扩展名,但不知道如何从url中删除整个文件名.
I want to make SEF url In that i want to remove file name also from the url. my site is in the core php, I manage to remove the extension from the url but didn't have idea that how to remove the whole file name from the url.
当我在Google上搜索时,我得到了.htaccess的代码
As i searched on google i got this code for the .htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我不知道如何在php中编写标头,使其进入相关文件,但不显示URL中的文件名.
I have no idea that how to write header in php so it goes in related file but don't show the file name in url.
<a href='http://mysite.com/edit/user/2/1'>click</a>
现在,如果我单击上面的链接,它将进入网址为"mysite.com/edit/user/2/1"的edit.php,
Now if i click on above link it does goto edit.php with url "mysite.com/edit/user/2/1",
因此,我该如何删除编辑"文件名.
so from this how can i remove file name that is "edit".
预先感谢
推荐答案
为什么?这不是SEO友好和用户友好的URL吗?您为什么要使它变得不受欢迎?但是无论如何,我的猜测是您希望/user
从外观上指向/edit
:
Why? Isn't that a SEO friendly and user friendly URL? Why would you want to make it un-user fiendly? But anyway my guess is that you want /user
to point to /edit
by the looks of it:
RewriteRule ^/?user/*$ /edit.php?type=user&%{QUERY_STRING}
通过使用此方法并为站点维护和用户导航添加不必要的复杂性,尽管您会使站点变得更糟.
Though you will be making your site worse by using this and adding uneeded complexity to not only site maintenance but also user navigation.
这篇关于没有名称的SEF网址,带有核心php和.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!