简体   繁体   English

PHP文件重命名虚拟沼泽环境htaccess

[英]php file renaming virtually wamp environment htaccess

Does PHP supports htaccess URL rewriting in Windows - WAMP Environment? PHP在Windows-WAMP环境中是否支持htaccess URL重写?

How can I use it? 如何使用?

Below is one example: 以下是一个示例:

My existing file name and URL is like below: 我现有的文件名和URL如下所示:

http://localhost/um/api_user_registration.php?FIRSTNAME=first_name&LASTNAME=last_name&USERNAME=user_name&EMAIL=abc@abc.com

Can I use it like below: 我可以像下面这样使用它吗:

http://localhost/um/UserRegistration.mac?FIRSTNAME=first_name&LASTNAME=last_name&USERNAME=user_name&EMAIL=abc@abc.com

In short, I want to access file as UserRegistration.mac instead of api_user_registration.php 简而言之,我想以UserRegistration.mac而不是api_user_registration.php身份访问文件

Please suggest a way of doing. 请提出一种解决方法。

You can try like this: 您可以这样尝试:

RewriteEngine on
Options +FollowSymlinks
RewriteBase /yourproject
RewriteRule ^UserRegistration.mac/([^/]+)/(.*)  api_user_registration.php?id=$1 [PT]

more info: http://goo.gl/EBzz6t 更多信息: http//goo.gl/EBzz6t

URL rewriting is done using mod_rewrite, an apache module. 使用Apache模块mod_rewrite完成URL重写。 Make sure that it's loaded (probably in httpd.conf) and then add this to the htaccess file in your /um/ folder: 确保已加载它(可能在httpd.conf中),然后将其添加到/um/文件夹中的htaccess文件中:

RewriteEngine On
RewriteBase /um/
RewriteRule ^UserRegistration\.mac$ api_user_registration.php [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM