Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.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
Php 为什么我的链接没有被缩短?_Php_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Php 为什么我的链接没有被缩短?

Php 为什么我的链接没有被缩短?,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,我正试图缩短我的链接,使它们变得漂亮,正如你在我的.htaccess代码中看到的那样,但出于某种原因,它没有听它们。为什么它不起作用 Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.migrus.mi-g\.us RewriteRule ^(.*)$ $1?lang=rus [QSA,L] RewriteRule ^home1/ home1/home1.php

我正试图缩短我的链接,使它们变得漂亮,正如你在我的.htaccess代码中看到的那样,但出于某种原因,它没有听它们。为什么它不起作用

Options +FollowSymlinks
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.migrus.mi-g\.us
RewriteRule ^(.*)$ $1?lang=rus [QSA,L]


RewriteRule    ^home1/   home1/home1.php [NC]
RewriteRule    ^home2/   home2/home2.php [NC]
RewriteRule    ^home3/   home3/home3.php [NC]

RewriteRule    ^certificates/([A-Za-z0-9-]+)/?$    certificates/certificate.php?cert_clean_url=$1 [QSA]
RewriteRule    ^order-form/?$    order-form/order-form.php [QSA]
RewriteRule    ^about/   about/about.php [NC]
RewriteRule    ^site-map/?$   site-map/site-map.php [QSA]

RewriteRule    ^contact/    contact/contact.php [NC]
RewriteRule    ^blog/   blog/blog.php [NC]
RewriteRule    ^blog-single/([A-Za-z0-9-]+)/?$    blog-single/blog-single.php?post_clean_url=$1 [QSA]

ErrorDocument  404  /404.php

问题是,如果没有重写条件,您的重写规则将在第一次执行时得到满足。每个规则都需要一个条件。您丢失了
$
比如
RewriteRule^home1/home1/home1.php[NC]
应该是
RewriteRule^home1/$home1/home1.php[NC]
谢谢,我刚刚添加了$。只是看不见而听不见。您在浏览器中输入的URL是什么?您希望看到内容的URL是什么?原始URL应该是
http://migrus.mi-g.us/home1.php
我只希望它被重写为
http://migrus.mi-g.us/home1