使用PHP htaccess的URL重写重写、PHP、htaccess、URL

由网友(陈獨秀)分享简介:http://www.example.com/justridesbeta/jstride/vehicle到http://www.example.com/justridesbeta/addride使用htaccess的。目前使用< IfModule mod_rewrite.c>选项​​+的FollowSy...

  http://www.example.com/justridesbeta/jstride/vehicle
 

  http://www.example.com/justridesbeta/addride
 

使用htaccess的。

PHP .htaccess 在自己电脑上运行正常上传到空间打不开

目前使用

 < IfModule mod_rewrite.c>
  选项​​+的FollowSymLinks
  RewriteEngine叙述上

  #摆脱的index.php
  的RewriteCond%{REQUEST_URI} /index.php
  重写规则(。*)的index.php?重写= 2 [L,QSA]

  #重写所有目录,寻找网址
  的RewriteCond%{REQUEST_URI} / $
  重写规则(。*)的index.php?重写= 1 [L,QSA]

  #尽量航线丢失的文件
  的RewriteCond%{} REQUEST_FILENAME!-f
  的RewriteCond%{} REQUEST_FILENAME公共 / [OR]
  的RewriteCond%{REQUEST_FILENAME} 。(JPG | GIF | PNG | ICO | FLV | HTM |全文| PHP | CSS | JS)$
  重写规则。 -  [L]

  #如果文件不存在,改写指数
  的RewriteCond%{} REQUEST_FILENAME!-f
  的RewriteCond%{} REQUEST_FILENAME!-d
  重写规则^(。*)$的index.php?重写= 1 [L,QSA]



  重写规则^ [A-ZA-Z0-9] + $ justridesbeta / jstride /汽车
  < / IfModule>
 

解决方案

 如果($ _ SERVER ['REQUEST_URI'] =='/ justridesbeta / jstride /车辆)
{
    标题(位置:http://www.example.com/justridesbeta/addride);
    出口;
}
 

如果你的真正的需要了。

http://www.example.com/justridesbeta/jstride/vehicle

to

http://www.example.com/justridesbeta/addride

using htaccess.

Currently using

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On

  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /index.php
  RewriteRule (.*) index.php?rewrite=2 [L,QSA]

  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*) index.php?rewrite=1 [L,QSA]

  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public/ [OR]
  RewriteCond %{REQUEST_FILENAME} .(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]

  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]



  RewriteRule ^[a-zA-Z0-9]+$ justridesbeta/jstride/vehicle
  </IfModule>

解决方案

if ($_SERVER['REQUEST_URI'] == '/justridesbeta/jstride/vehicle')
{
    header("Location: http://www.example.com/justridesbeta/addride");
    exit;
}

if you really need that

阅读全文

相关推荐

最新文章