Php 在godaddy共享服务器上使用.htaccess进行友好URL/URL重写

Php 在godaddy共享服务器上使用.htaccess进行友好URL/URL重写,php,url,rewriting,Php,Url,Rewriting,我一直在到处寻找一些代码来使用我的godaddy URL重写,但运气不好 我正在尝试使用.htaccess的友好URL创建我的网站,例如domain.com/company/buy/items.php?fatherID=23=>into==>domain.com/23我尝试了几乎所有的代码,最好的办法是删除.php 示例代码: 选项+以下符号链接-多视图 打开mod_rewrite 重新启动发动机 重写基/ 重写规则^/([0-9]+)/?$company/items.php?父ID=$1[NC

我一直在到处寻找一些代码来使用我的godaddy URL重写,但运气不好

我正在尝试使用.htaccess的友好URL创建我的网站,例如domain.com/company/buy/items.php?fatherID=23=>into==>domain.com/23我尝试了几乎所有的代码,最好的办法是删除.php

示例代码:

选项+以下符号链接-多视图

打开mod_rewrite

重新启动发动机

重写基/

重写规则^/([0-9]+)/?$company/items.php?父ID=$1[NC,L]

有人知道一些简单的代码吗?我在godaddys共享Linux服务器上

我试图用以下代码来还原404错误代码: ErrorDocument 404/domain.com/home/404error.php 但这也不起作用


有什么我不知道的吗?

试试这个,应该有用

<IfModule mod_rewrite.c>
 Options -MultiViews      
  RewriteEngine on
  RewriteBase /
  RewriteRule ^([0-9]+)$ company/items.php?fatherID=$1 [L]
</IfModule>

选项-多视图
重新启动发动机
重写基/
重写规则^([0-9]+)$company/items.php?父ID=$1[L]

试试这个,它应该是有效的

<IfModule mod_rewrite.c>
 Options -MultiViews      
  RewriteEngine on
  RewriteBase /
  RewriteRule ^([0-9]+)$ company/items.php?fatherID=$1 [L]
</IfModule>

选项-多视图
重新启动发动机
重写基/
重写规则^([0-9]+)$company/items.php?父ID=$1[L]

戈达迪是一个特例。这肯定会奏效的

 DirectoryIndex index.php
 AddDefaultCharset utf-8

 RewriteEngine on
 Options +FollowSymlinks -MultiViews -Indexes   

 RewriteBase /
 RewriteRule ^/([0-9]+)/?$ company/items.php?fatherID=$1 [NC,L]

戈达迪是个特例。这肯定会奏效的

 DirectoryIndex index.php
 AddDefaultCharset utf-8

 RewriteEngine on
 Options +FollowSymlinks -MultiViews -Indexes   

 RewriteBase /
 RewriteRule ^/([0-9]+)/?$ company/items.php?fatherID=$1 [NC,L]

删除前导的/斜杠/对其进行可选化。而且您没有RewriteBase.Remove/optionalize前导的
/
斜杠的用例。您没有RewriteBase的用例。我尝试了代码,但没有成功。我有什么遗漏吗?起初我没有.htaccess文件。我还试图清除我的所有web历史记录和Cookies我想你没有启动带有选项+followsymlink的.htaccess文件我尝试了代码,但没有成功。我有什么遗漏吗?起初我没有.htaccess文件。我还试图清除我所有的web历史记录和Cookies我想你没有启动带有选项+FollowSymlinks的.htaccess文件