Skip to content

Instantly share code, notes, and snippets.

@Max95Cohen
Created January 31, 2023 04:23
Show Gist options
  • Save Max95Cohen/33b180174469bb9dfcabfb2978b68c3e to your computer and use it in GitHub Desktop.
Save Max95Cohen/33b180174469bb9dfcabfb2978b68c3e to your computer and use it in GitHub Desktop.
.htaccess examples
# http://maq.kz/123/
RewriteRule ^([1-9]+)/$ index.php?article=$1 [L]
## ajax http://maq.kz/dnfksnfsk/scripts/mslmflsmfsl/
RewriteRule ^(.+)/scripts/ scripts.php [L]
## pages http://maq.kz/page/123
RewriteRule ^page/(.*)$ index.php?a=1&b=2&c=$1 [L]
##
RewriteRule ^(.*).php$ index.php [L]
## not URL to default
RewriteCond %{REQUEST_FILENAME} !-F
RewriteRule ^(.+) http://a3.kz/ [L]
RewriteEngine on
## ARTICLE
RewriteRule ^([0-9]+)/$ index.php?article=$1 [L]
## OTHER PAGES
RewriteRule ^page/([a-z]{1,3})/$ index.php?otherpage=$1 [L]
## PAGE
RewriteRule ^page/([0-9]{1,2})/$ index.php?page=$1 [L]
## AJAX
RewriteRule ^(.*)/scripts/(.*)/$ scripts.php [L]
## PHP
#RewriteRule ^(.{1})\.php$ http://a3.kz/ [L]
# ErrorDocument 404 http://a3.kz/
# RedirectMatch ^(.*)/styles.css$ http://mysite.com/styles_last.css //<link href="styles.css" rel="stylesheet" type="text/css">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment