.htaccess 重写我网站的 URL

编程入门 行业动态 更新时间:2024-10-25 04:22:50
本文介绍了.htaccess 重写我网站的 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

也许你可以帮我重写我的 URL(我从来没有使用过 .htacces 文件).

maybe you can help me to rewrite my URL (i never worked with a .htacces-file).

示例:我有一个这样的 URL:localhost/index.php?s=example

Example: I have a URL like this: localhost/index.php?s=example

我怎么可能像这样使用这个 URL:localhost/example?

How i can chance this URL like this: localhost/example ?

也许你能帮我.

谢谢!

推荐答案

您可以在 root/.htaccess

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

此脚本将允许您使用干净的 url /foobar

This script will allow you to access /index.php?s=foobar using the clean url /foobar

更多推荐

.htaccess 重写我网站的 URL

本文发布于:2023-11-01 17:43:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549988.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   网站   htaccess   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!