简体   繁体   English

htaccess重写规则,用于重定向和删除扩展

[英]htaccess rewrite rule for redirecting and removing extensions

In my .htaccess file I have these rewrites 在我的.htaccess文件中,这些重写

#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^\.]+)$ $1.php [NC,L]
 RewriteRule ^/admin/$ http://socialable.comuv/admin.php [R=301,L]
#noted out three lines since it's not what I need anymore I forgot the RewriteRule originally

Yet now it seems to not work at all, it keeps giving errors everywhere. 但是现在它似乎根本不起作用,它到处都在出错。 I want is this 我要的是这个

/admin/ (directory) to become /admin.php (file) / admin /(目录)成为/admin.php(文件)
administration.php to become /administration Administration.php成为/ administration

Try this: 尝试这个:

RewriteRule ^admin/?$ admin.php [R,L]
RewriteRule ^administration\.php administration [R,L]

Once you are satisfied that the redirect works, you can change the R to R=301 to make it permanent. 一旦确定重定向有效,就可以将R更改为R=301以使其永久不变。

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

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