PHP的.htaccess改写view.php?visopslag =(ID) [英] .htaccess php Rewrite view.php?visopslag=(id)

查看:294
本文介绍了PHP的.htaccess改写view.php?visopslag =(ID)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不重写 www.url.com/opslag/view.php?visopslag=(ID)与htaccess的东西更漂亮:O)进出口创造一个论坛可能的应用程序。这是我想重写: 我的要求是:

  www.url.com/opslag/vis/id
 

我怎样才能做到这一点?我试过很多不同的东西,如:

 重写规则^ / opslag /([^/\.]+)/?$ view.php?可见= $ 1 [L]
 

我的完整的.htaccess:

  

RewriteEngine叙述在
  #Rewrite view.php?可见= ID
  重写规则^ opslag /可见/([0-9] +)$ /opslag/view.php?vis=$1 [L,R,QSA]

     

#删除的index.php
  #RewriteCond%{THE_REQUEST} ^ [AZ] {3,9} \ /。的的index.php \ HTTP /
  #RewriteRule ^(。
的)的index.php / $ 1 [R = 301,L]

     

#删除/页/
  #RewriteCond%{} REQUEST_FILENAME!-f
  #RewriteCond%{} REQUEST_FILENAME!-d
  #RewriteRule ^([^ /] +)/ $的index.php?网页= $ 1 [L]

解决方案

请让你的的.htaccess 文件的备份。现在,删除所有行 - 让它空着(有太多的噪音出现的那一刻)

添加这些行到你空的.htaccess(应该是在你的网站的根文件夹):

  RewriteEngine叙述上
重写规则^ opslag /可见/(\ d +)$ /opslag/view.php?vis=$1 [NC,QSA,L]
 

这应该把 www.url.com/opslag/vis/11 www.url.com/opslag/view.php?vis = 11

请确保您有没有更多的的.htaccess 文件 opslag 文件夹。

I have to rewrite www.url.com/opslag/view.php?visopslag=(id) with htaccess to something more beautiful :o) Im creating a forum likely application. This is what i want to be rewrote: My request is:

www.url.com/opslag/vis/id 

How can I do this? I've tried lots of different things like:

RewriteRule ^/opslag/([^/\.]+)/?$ view.php?vis=$1 [L]

My complete .htaccess:

RewriteEngine On
"#Rewrite view.php?vis=id
RewriteRule ^opslag/vis/([0-9]+)$ /opslag/view.php?vis=$1 [L,R,QSA]

"#Remove index.php
"#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.index.php\ HTTP/
"#RewriteRule ^(.
)index.php$ /$1 [R=301,L]

"#Remove /page/
"#RewriteCond %{REQUEST_FILENAME} !-f
"#RewriteCond %{REQUEST_FILENAME} !-d
"#RewriteRule ^([^/.]+)/?$ index.php?page=$1 [L]

解决方案

Please make a backup of your .htaccess file. Now remove all lines -- make it empty (there is too much noise there at the moment).

Add these lines to your empty .htaccess (should be in the root folder of your website):

RewriteEngine On
RewriteRule ^opslag/vis/(\d+)$ /opslag/view.php?vis=$1 [NC,QSA,L] 

This should treat www.url.com/opslag/vis/11 as www.url.com/opslag/view.php?vis=11.

Please ensure that you have no more .htaccess files in opslag folder.

这篇关于PHP的.htaccess改写view.php?visopslag =(ID)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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