如何删除用户配置文件?USER = MYNAME通过htacces [英] How to remove userprofile?user=myname by htacces

查看:209
本文介绍了如何删除用户配置文件?USER = MYNAME通过htacces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于我的问题,我发现了更多的解决方案在这里stockoverflow和其他许多网站。但是,所有这些htaccess的规则不适合我。

我要删除用户配置文件?USER = USERPROFILE?USER = MYNAME

我从GoDaddy的域名和onelancer托管 Apache的版本2.2.27 PHP版本5.4.28

我不知道有关htaccess的规则?

  

我当前的URL是这样的:domain.com/myfolder/userprofile?user=myname
  在这里,我已经隐藏 MyFolder中从URL通过htaccess的

我的.htaccess:(在网站根目录)

  ###删除了MyFolder的###(工作好)
选项​​+的FollowSymLinks -MultiViews
#开启mod_rewrite的上
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME -f .PHP
的RewriteCond%{REQUEST_URI}!/ $
重写规则(。*)$ 1 \ .PHP [L]
的RewriteCond%{THE_REQUEST} ^ [AZ] {3,} \ S / + MyFolder中/([^ \ s] +)[NC]
重写规则^%1 [R = 301,L]
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则(?!^ MyFolder中/)^(.*)$ / MyFolder中/ $ 1 [L,NC]

###删除用户配置文件的用户= ###?(不工作 -  500错误页面所有的)
选项​​+的FollowSymLinks -MultiViews
#开启mod_rewrite的上
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{THE_REQUEST} \ S / + USERPROFILE \ USER =([^&放大器; \ S] +)?[NC]
重写规则^%1 [R = 301,L]
的RewriteCond%{DOCUMENT_ROOT}%{REQUEST_URI} \ PHP -f [NC]
重写规则^(。+?)/?$ $ 1.PHP [L]
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^([\ w  - ] +)?/ $ USERPROFILE用户= $ 1 [L,QSA]
 

解决方案

有这样说道:

根的.htaccess

 选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上

的RewriteCond%{THE_REQUEST} \ S / + MyFolder中/ USERPROFILE \ USER =([^&放大器; \ S] +)?[NC]
重写规则^ /%1 [R = 301,L]

的RewriteCond%{THE_REQUEST} \ S / + MyFolder中/(\ S *)[NC]
重写规则^ /%1 [R = 301,L]

的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^((?!^ MyFolder中/).*)$ / MyFolder中/ $ 1 [L,NC]
 

/myfolder/.htaccess:

 选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上
的RewriteBase / MyFolder中/

的RewriteCond%{DOCUMENT_ROOT}%{REQUEST_URI} \ PHP -f [NC]
重写规则^(。+?)/?$ $ 1.PHP [L]

的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^([\ w  - ] +)?/ $ USERPROFILE用户= $ 1 [L,QSA]
 

About my question I found many more solution here stockoverflow and many others web site. But all of those htaccess rules not work for me.

I want remove userprofile?user= from userprofile?user=myname

My domain from Godaddy and hosting from onelancer Apache Version 2.2.27 PHP Version 5.4.28

I have no idea about htaccess rule?

my current url is like: domain.com/myfolder/userprofile?user=myname
Here I already hide myfolder from url by htaccess

My .htaccess: ( At website root )

### Removed myfolder ### ( Working well )
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+myfolder/([^\s]+) [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (?!^myfolder/)^(.*)$ /myfolder/$1 [L,NC]    

### Remove userprofile?user= ### ( Not working - 500 error of all page )
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+userprofile\?user=([^&\s]+) [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ userprofile?user=$1 [L,QSA]

解决方案

Have it this way:

root .htaccess

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+myfolder/userprofile\?user=([^&\s]+) [NC]
RewriteRule ^ /%1 [R=301,L]

RewriteCond %{THE_REQUEST} \s/+myfolder/(\S*) [NC]
RewriteRule ^ /%1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?!^myfolder/).*)$ /myfolder/$1 [L,NC]

/myfolder/.htaccess:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /myfolder/

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ userprofile?user=$1 [L,QSA]

这篇关于如何删除用户配置文件?USER = MYNAME通过htacces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆