繁体   English   中英

使用htaccess输入我的域名的短网址

[英]Short url for my domain name using htaccess

我想为我的域创建一个自定义URL。

例如我想要这样的网址:-mysite.com/ERJDII787HUKKS

代替:-mysite.com/index.php?args=ERJDII787HUKKS

我已经试过了:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^$ /index.php/$1 [L]

But its not working well please help!!

您使用的正则表达式为空,因此它与您尝试访问的任何URL不匹配。 您应该用您的真实URL重写它。 尝试使用此:

RewriteRule ^(.*)$ /index.php?args=$1 [L]

希望能解决您的问题。

在根目录中尝试以下规则

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^([\w-]+)$ index.php?args=$1 [L]

暂无
暂无

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

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