如何使用的.htaccess创造清洁网址 [英] How to create clean url using .htaccess
问题描述
这是我.htaaccess code。
This is my .htaaccess code.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)/$ movie.php?name=$1
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example\.in$
RewriteRule ^/?$ "http\:\/\/example\.in" [R=301,L]
ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
Header unset ETag
FileETag None
我需要干净的网址为我的网站。 我已经提到很多的教程和论坛中创建的上述code。 但不是工作..几乎我打与code。 我不明白干净的URL概念清晰。有没有我已经在我的PHP页面写任何的编码。
I need clean url for my website. I've referred lots of tutorials and forums and created the above code. But not working.. Almost I'm fighting with code. I dont understand the clean url concept clearly. Is there any codings I ve to write on my php page.
<a href='movie.php?name=titanic'> Titanic </a>
我在我的index.php文件链接。
I've this link in my index.php file.
我想 example.in/movie/titanic
同时点击链接泰坦尼克号。
I want example.in/movie/titanic
while click the link Titanic.
此外,我想在$ _ [要求]来获取值。
Also I want to get the value by $_[request].
究竟我得做。请不要使这个问题的重复,我搜索了很多,并没有得到明确的概念。请帮我。
What exactly I've to do. Please dont make this question as duplicate, I've searched a lot and didn't got the concept clearly. Please help me out.
感谢
推荐答案
替换您的code这一点:
Replace your code with this:
ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
Header unset ETag
FileETag None
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+movie\.php\?name=([^\s&]+) [NC]
RewriteRule ^ movie/%1? [R=301,L]
RewriteRule ^movie/([^/]+)/?$ movie.php?name=$1 [L,QSA]
这篇关于如何使用的.htaccess创造清洁网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!