.htaccess mod rewrite [公共配置文件,而不是私有的]

时间:2018-12-01 23:26:26

标签: php .htaccess

我有一个社交网络脚本,我试图将其个人资料设为公开,而不是转发至登录屏幕。我的.htaccess代码在下面...

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

ErrorDocument 404 https://corriv.com/sources/not-found.php          
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=302,NE,L]

RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*)index\.php$ /$1 [L,R=302,NC,NE]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^status/([\w-]+)/?$ status.php?msgID=$1 [L,QSA]
RewriteRule ^hashtag/([^/]+)/?$ hashtags.php?tag=$1 [L,QSA]
RewriteRule ^settings/([\w-]+)/?$ settings.php?set=$1 [L,QSA]
RewriteRule ^account/([\w-]+)/?$ sources/index.php?get=$1 [L,QSA]
RewriteRule ^dashboard/([\w-]+)/?$ admin/index.php?set=$1 [L,QSA]
RewriteRule ^profile/([^/]+)/?$ profile.php?username=$1 [L,QSA,NC]  
RewriteRule ^profile/(followers|friends|saved)/([^/]+)/?$ $1.php?username=$2 [L,QSA,NC]

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

<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin '*'
</IfModule>

如果链接到有关如何学习.htaccess mod rewrite的教程的链接,我也将不胜感激。

0 个答案:

没有答案