使用get参数将目录重写为php文件

时间:2017-08-27 06:19:58

标签: apache .htaccess url-rewriting

我想从

重定向用户
// Replication.ChangeListener
@Override
public void changed(Replication.ChangeEvent changeEvent) {
  if (changeEvent.getError() != null) {
    Throwable lastError = changeEvent.getError();
    // React to the error
    return;
  }

  if (changeEvent.getTransition() == null) return;

  ReplicationState dest = changeEvent.getTransition().getDestination();

  replicationActive = ((dest == ReplicationState.STOPPING || dest == ReplicationState.STOPPED) ? false : true);

  // Do something here if true
}

localhost/test/Mj4sD

而Mj4sd是5个字母的模式(小写,大写,数字)。    我目前的配置:

localhost/test/short.php?url=Mj4sD

1 个答案:

答案 0 :(得分:0)

您必须将RewriteRule更改为:

RewriteRule ^(\w+)$ ./short.php?url=$1