Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用.htaccess文件和PHP创建类似FB的URL_Php_Html - Fatal编程技术网

使用.htaccess文件和PHP创建类似FB的URL

使用.htaccess文件和PHP创建类似FB的URL,php,html,Php,Html,我们的网站链接是www.abc.com 我有3个PHP文件 index.php profile.php add.php 我想皈依 index.php url,如“www.abc.com/home” profile.php url(在“www.abc.com/profile.php?id=no1”之前)到“www.abc.com/user_name” (或像这样的“www.abc.com/abrar”或“www.abc.com/jahin”或“www.abc.com/piash”) add.php

我们的网站链接是www.abc.com 我有3个PHP文件

  • index.php
  • profile.php
  • add.php
  • 我想皈依

  • index.php url,如“www.abc.com/home”
  • profile.php url(在“www.abc.com/profile.php?id=no1”之前)到“www.abc.com/user_name” (或像这样的“www.abc.com/abrar”或“www.abc.com/jahin”或“www.abc.com/piash”)
  • add.php url,如“www.abc.com/add”
  • 我使用的是原始PHP

    有人能帮我吗


    提前感谢。

    通过
    重写规则
    更新您的
    .htaccess
    文件。例如:

    RewriteEngine On
    
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
    
    RewriteRule ^home$ ./home.php
    RewriteRule ^user_name/(\d+)*$ ./profile.php?id=$1
    
    RewriteRule ^add$ ./add.php
    

    我想让我的个人资料看起来像另一个页面,可能吗?我想让我的个人资料看起来像“另一个页面”,可能吗?