Php htaccess可实现stackoverflow等链接
可能重复:Php htaccess可实现stackoverflow等链接,php,.htaccess,Php,.htaccess,可能重复: 假设我的页面链接是这样的 我怎么去 我有多个页面,比如 另外,如何从表单或锚定标签发布 这像是行动吗?”http://example.com/test.php?id=10978&name=html-初学者教程” 或动作=”http://example.com/10978/html-tutorial-for-beginners" 对于锚定标记href=”http://example.com/test.php?id=10978&name=html-初学者教程” 或 href=”
假设我的页面链接是这样的 我怎么去 我有多个页面,比如 另外,如何从表单或锚定标签发布 这像是行动吗?”http://example.com/test.php?id=10978&name=html-初学者教程” 或动作=”http://example.com/10978/html-tutorial-for-beginners" 对于锚定标记href=”http://example.com/test.php?id=10978&name=html-初学者教程” 或 href=”http://example.com/10978/html-tutorial-for-beginners" 如何为test.php、more_test.php和some_more_test.php等多个文件实现它
谢谢你的帮助 基于您的链接修改,我认为您希望在核心php文件中创建SEO freindly url。基本上,它是MVC框架中的每一个 但在php代码中仍然不是不可能的 第一步 创建index.php文件或任何其他文件,每次调用页面时都会指向这些文件 创建.htaccess文件,在该文件中定义任何页面调用请求。 下面是.htaccess文件代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
在index.php中,我们检查了页面的请求或url,并在此基础上调用所需的文件或操作[通过提取查询字符串]
希望这对您也有帮助