url 不重写我正在使用下面的代码并且 mod_rewrite 也在
url not rewriting i am using below code and mod_rewrite is also on
我的 url 是这样的:
但我想要一个 seo 友好的 url,例如:
我在我的 httaccess 中使用下面的 url RewriteRule 但它不起作用
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ mock_profile.php?user_name=Yasin
RewriteRule ^([a-zA-Z0-9_-]+)/$ mock_profile.php?user_name=Yasin
## Below is my all httacess code ##
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ .php [nc]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]
#RewriteRule ^(.*).html$ .php [QSA]
RewriteCond %{THE_REQUEST} \ /(.+)\.php
RewriteRule ^ /%1.html [NC,L,R=301]
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_-]+)/?$ mock_profile.php?user_name=
试试这个:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_-]+)/?$ mock_profile.php?user_name= [L]
解释:
如果请求是针对现有目录,则以下条件告诉服务器停止重写。
RewriteCond %{REQUEST_FILENAME} !-d
如果请求是针对有效文件,这会告诉服务器停止重写:
RewriteCond %{REQUEST_FILENAME} !-f
如果请求不是针对文件 /dir ,则重写它:
RewriteRule ^([a-zA-Z0-9_-]+)/?$ mock_profile.php?user_name=
我的 url 是这样的:
但我想要一个 seo 友好的 url,例如:
我在我的 httaccess 中使用下面的 url RewriteRule 但它不起作用
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ mock_profile.php?user_name=Yasin
RewriteRule ^([a-zA-Z0-9_-]+)/$ mock_profile.php?user_name=Yasin
## Below is my all httacess code ##
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ .php [nc]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]
#RewriteRule ^(.*).html$ .php [QSA]
RewriteCond %{THE_REQUEST} \ /(.+)\.php
RewriteRule ^ /%1.html [NC,L,R=301]
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_-]+)/?$ mock_profile.php?user_name=
试试这个:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_-]+)/?$ mock_profile.php?user_name= [L]
解释:
如果请求是针对现有目录,则以下条件告诉服务器停止重写。
RewriteCond %{REQUEST_FILENAME} !-d
如果请求是针对有效文件,这会告诉服务器停止重写:
RewriteCond %{REQUEST_FILENAME} !-f
如果请求不是针对文件 /dir ,则重写它:
RewriteRule ^([a-zA-Z0-9_-]+)/?$ mock_profile.php?user_name=