Perfect PHP .htaccess rewrites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What this does is enable rewriting, then checks if your trying to access something that exits | |
# if not it will take you to the index, with the path your requesting attached to the url varible | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* What this does is take that url variable and break it into a high usable $_urlvars variable that you can then use to load files or pass information with */ | |
$_urlvars = explode('/',$_REQUEST['url']); | |
$_urlvars['_'.$k] = $v; | |
foreach($_urlvars as $k => $v){ | |
$_urlvars[$v] = (isset($_urlvars[$k+1])?$_urlvars[$k+1]:''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment