Forum Moderators: phranque
RewriteRule \.(css|jpe?g|gif|png|flv|swf)$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Main Menu Links #
RewriteRule ^videos/load/([^/]*)$ seemore.php?load=$1 [L]
RewriteRule ^videos/load/([^/]*)/([^/]*)$ seemore.php?load=$1&page=$2 [L]
RewriteRule ^audios/load/([^/]*)$ audio.php?load=$1 [L]
RewriteRule ^audios/load/([^/]*)/([^/]*)$ audio.php?load=$1&page=$2 [L]
RewriteRule ^audio/album/([^/]*)/([^/]*)$ audio.php?album=$1 [L]
RewriteRule ^audio/album/([^/]*)/([^/]*)/([^/]*)$ audio.php?album=$1&page=$3 [L]
RewriteRule ^blogs/load/([^/]*)$ blogs.php?load=$1 [L]
RewriteRule ^blogs/load/([^/]*)/([^/]*)$ blogs.php?load=$1&page=$2 [L]
RewriteRule ^albums/load/([^/]*)$ albums.php?load=$1 [L]
RewriteRule ^albums/([^/]*)/([^/]*)$ albums.php?load=$1&page=$2 [L]
RewriteRule ^people_ajax people_ajax.php [L]
RewriteRule ^people/([^/]*)/([^/]*)$ people.php?load=$1&page=$2 [L]
RewriteRule ^people people.php [L]
RewriteRule ^upload-media upload.php [L]
RewriteRule ^groups$ groups.php [L]
RewriteRule ^search search.php [L]
# Action Links #
RewriteRule ^videos-([0-9]*)-(.*) play.php?vid=$1 [R=301,L]
RewriteRule ^videos/([^/]*)/([^/]*)$ play.php?vid=$1 [L]
RewriteRule ^audio/([^/]*)/([^/]*)$ play_audio.php?audio=$1
RewriteRule ^category/([^/]*)$ category_home.php?cid=$1 [L]
RewriteRule ^category/([^/]*)/([^/]*)$ category_home.php?cid=$1&page=$2 [L]
RewriteRule ^subcategory/([^/]*)/([^/]*)$ category_home.php?sub=$1 [L]
RewriteRule ^subcategory/([^/]*)/([^/]*)/([^/]*)$ category_home.php?sub=$1&page=$3 [L]
RewriteRule ^genre/([^/]*)$ genre_home.php?cid=$1 [L]
RewriteRule ^genre/([^/]*)/([^/]*)$ genre_home.php?cid=$1&page=$2 [L]
RewriteRule ^view-album/([^/]*)/([^/]*)$ album_view.php?album=$1
RewriteRule ^view-image/([^/]*)/([^/]*)$ album_view.php?image=$1
RewriteRule ^read_blog/([^/]*)/([^/]*)$ read_blog.php?id=$1 [L]
RewriteRule ^blogs/category/([^/]*)/([^/]*)$ blogs.php?cat_id=$1 [L]
RewriteRule ^blogs/category/([^/]*)/([^/]*)/([^/]*)$ blogs.php?cat_id=$1&page=$3 [L]
RewriteRule ^members/([^/]*)$ memberprofile.php?user=$1 [L]
#-------------------------------------------------------------#
# redirect directory browsing attempts
RewriteRule ^videos(.?)$ seemore.php [L]
RewriteRule ^audios(.?)$ audio.php [L]
RewriteRule ^blogs(.?)$ blogs.php [L]
RewriteRule ^members(.?)$ people [R=301]
RewriteRule ^albums(.?)$ albums.php [L]
#-------------------------------------------------------------#
#--------------------------------------- END SEO ----------------------------------------#
#--------------------------------------- SOME SIMPLE BLOCKS -----------------------------#
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteCond %{QUERY_STRING} SELECT(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} UNION(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteRule ^(.*)$ index.php [F,L]
#--------------------------------------- END BLOCKS -------------------------------------#
#<IfModule mod_security.c>
# secfilterengine off
# secfilterscanPOST off
#</IfModule>
Options All -Indexes
FileETag MTime Size
Options +FollowSymlinks
RewriteEngine on
<FilesMatch "\.(db|inc|tmpl|h|ihtml|sql|ini|configuration|config|class|bin|spd|theme|module|cfg|cpl|tmp|log|err|i nc.php|class.php)$">
order allow,deny
satisfy all
</FilesMatch>
########## Begin - Rewrite rules to block out some common exploits
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
#RewriteRule ^(.*)$ index.php [L]
RewriteRule ^([^.]*)/?$ index.php [L]
#
########## End - Rewrite rules to block out some common exploits
RewriteEngine on
#
#
#
#URL Rewriting for Videos
RewriteRule ^videos/(.*)/(.*)/(.*)/(.*)/(.*) videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^videos/([0-9]+) videos.php?page=$1 [L]
RewriteRule ^videos/?$ videos.php?%{QUERY_STRING} [L]
RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
#Alternate watch video links
RewriteRule ^(.*)\_v([0-9]+) watch_video.php?v=$2&%{QUERY_STRING} [L]
RewriteRule ^video/([0-9]+)_(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
#
#Users, Channel & Management
#
RewriteRule ^channels/(.*)/(.*)/(.*)/(.*)/(.*) channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^channels/([0-9]+) channels.php?page=$1 [L]
RewriteRule ^channels/?$ channels.php [L]
RewriteRule ^members/?$channels.php [nc]
RewriteRule ^users/?$channels.php [nc]
RewriteRule ^user/(.*)view_channel.php?user=$1 [nc]
RewriteRule ^channel/(.*)view_channel.php?user=$1 [nc]
RewriteRule ^my_accountmyaccount.php [nc]
#Pages
RewriteRule ^page/([0-9]+)/(.*)view_page.php?pid=$1 [nc]
#
#Miscellenous
RewriteRule ^search/result/?$search_result.php [nc]
RewriteRule ^upload/?$upload.php [nc]
RewriteRule ^contact/?$contact.php [nc]
RewriteRule ^categories/?$categories.php [nc]
#Group Section
RewriteRule ^group/([a-zA-Z0-9].+)view_group.php?url=$1&%{QUERY_STRING} [L]
RewriteRule ^view_topic/([a-zA-Z0-9].+)_tid_([0-9]+)view_topic.php?tid=$2&%{QUERY_STRING} [L]
RewriteRule ^groups/(.*)/(.*)/(.*)/(.*)/(.*) groups.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^groups/([0-9]+) groups.php?page=$1 [L]
RewriteRule ^groups/?$ groups.php [L]
RewriteRule ^create_group create_group.php [L]
#Collection Section
RewriteRule ^collections/(.*)/(.*)/(.*)/(.*)/(.*) collections.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^collections/([0-9]+) collections.php?page=$1 [L]
RewriteRule ^collections/?$ collections.php [L]
RewriteRule ^photos/(.*)/(.*)/(.*)/(.*)/(.*) photos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^photos/([0-9]+) photos.php?page=$1 [L]
RewriteRule ^photos/?$ photos.php [L]
RewriteRule ^collection/(.*)/(.*)/(.*)view_collection.php?cid=$1&type=$2&%{QUERY_STRING} [L]
#Photo Section
RewriteRule ^item/(.*)/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L]
RewriteRule ^photo_upload/(.*) photo_upload.php?collection=$1 [L]
RewriteRule ^photo_upload/?$photo_upload.php [L]
#
RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup/?$ signup.php
#Error Pages
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
########## End - Rewrite rules For SEO urls ######################
RewriteRule ^rss$ rss.php [nc]
RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING} [nc]
########## End - Rewrite rules For SEO urls ######################
RewriteRule^([a-zA-Z0-9-]+)/?$ view_channel.php?uid=$1&seo_diret=yes [NS]
# Action Links #
RewriteRule ^videos-([0-9]*)-(.*) play.php?vid=$1 [R=301,L]
RewriteRule ^videos/([^/]*)/([^/]*)$ play.php?vid=$1 [L]
RewriteRule ^category/([^/]*)$ category_home.php?cid=$1 [L]
RewriteRule ^category/([^/]*)/([^/]*)$ category_home.php?cid=$1&page=$2 [L]
If only there were some middle ground between Not Enough Information and dumping out the entire htaccess (or stylesheet, or ...)
RewriteRule \.(css|jpe?g|gif|png|flv|swf)$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos/load/([^/]*)$ seemore.php?load=$1 [L]
My current url looks something like: http://www.example.com/videos/3857/example-page
The new url will look like: http://example.com/example-page_v13865
The categories on the current url: http://www.example.com/category/sample
new url: http://example.com/videos/1022/sample/most_recent/all_time/
RewriteRule ^upload-media upload.php [L] example.com/upload-media was requested, the pointer was internally rewritten to fetch the content from /upload.php without revealing what that internal location was. RewriteRule ^upload/?$ upload.php [nc] example.com/upload example.com/Upload example.com/uPload example.com/upLoad example.com/UPload example.com/UpLoad example.com/UPLOAd example.com/UPLOAD example.com/upload/ example.com/Upload/ example.com/uPload/ example.com/upLoad/ example.com/UPload/ example.com/UpLoad/ example.com/UPLOAd/ example.com/UPLOAD/ RewriteRule ^upload-media upload.php [L] (from old file) RewriteRule ^upload/?$ upload.php [nc] (from new file) # Redirect old URLs on old site to new URL on new site
RewriteRule ^upload-media http://www.example.com/upload [R=301,L,NC] # Fix to redirect non-canonical requests on new site to lower-case without slash
RewriteCond %{REQUEST_URI} !^/upload$
RewriteRule ^upload/?$ http://www.example.com/upload [R=301,L,NC] # Rewrite requests (only valid URL is lower case without slash) to serve content
RewriteRule ^upload$ /upload.php [L]
Additionally, the /? and [nc] in the new rewrite are very unsafe. It allows multiple duplicate content issues:
example.com/upload
example.com/Upload
example.com/uPload
example.com/upLoad
example.com/UPload
example.com/UpLoad
etc
example.com/UPLOAd
example.com/UPLOAD
and
example.com/upload/
example.com/Upload/
example.com/uPload/
example.com/upLoad/
example.com/UPload/
example.com/UpLoad/
etc
example.com/UPLOAd/
example.com/UPLOAD/
are all duplicates.
Remove the /? part. URLs for pages do not end in a trailing slash.
Remove the [nc] flag. Never use the [nc] flag with an internal rewrite. Use it only on an external redirect.
RewriteRule ^upload-media upload.php [L] (from old file)
...
RewriteRule ^upload/?$ upload.php [nc] (from new file)
#<IfModule mod_security.c>
# secfilterengine off
# secfilterscanPOST off
#</IfModule>
Options All -Indexes
FileETag MTime Size
Options +FollowSymlinks
RewriteEngine on
<FilesMatch "\.(db|inc|tmpl|h|ihtml|sql|ini|configuration|config|class|bin|spd|theme|module|cfg|cpl|tmp|log|err|inc.php|class.php)$">
order allow,deny
satisfy all
</FilesMatch>
### 1. Old Script - Redirect css, extensions, filenames ###
#RewriteRule \.(css|jpe?g|gif|png|flv|swf)$ - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
### END REDIRECT CSS, EXTENSIONS, FILENAMES ###
########## Begin - Rewrite rules to block out some common exploits
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
#RewriteRule ^(.*)$ index.php [L]
RewriteRule ^([^.]*)/?$ index.php [L]
#
########## End - Rewrite rules to block out some common exploits
RewriteEngine on
#
#
#
#
#URL Rewriting for Videos
### 2. Action Links - OLD SCRIPT REDIRECT VIDEO URLS ###
# 2.1 RewriteRule ^videos-([0-9]*)-(.*) play.php?vid=$1 [R=301,L]
# 2.2 RewriteRule ^videos/([^/]*)/([^/]*)$ play.php?vid=$1 [L]
RewriteRule ^videos/(.*)/(.*)/(.*)/(.*)/(.*) videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
### 3. REDIRECT VIDEO CATEGORIES ###
# RewriteRule ^category/([^/]*)$ category_home.php?cid=$1 [L]
# RewriteRule ^category/([^/]*)/([^/]*)$ category_home.php?cid=$1&page=$2 [L]
### END REDIRECT VIDEO CATEGORIES ###
RewriteRule ^videos/([0-9]+) videos.php?page=$1 [L]
RewriteRule ^videos/?$ videos.php?%{QUERY_STRING} [L]
RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
#Alternate watch video links
RewriteRule ^(.*)\_v([0-9]+) watch_video.php?v=$2&%{QUERY_STRING} [L]
RewriteRule ^video/([0-9]+)_(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
#
#Users, Channel & Management
#
RewriteRule ^channels/(.*)/(.*)/(.*)/(.*)/(.*) channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^channels/([0-9]+) channels.php?page=$1 [L]
RewriteRule ^channels/?$ channels.php [L]
RewriteRule ^members/?$channels.php [nc]
RewriteRule ^users/?$channels.php [nc]
RewriteRule ^user/(.*)view_channel.php?user=$1 [nc]
RewriteRule ^channel/(.*)view_channel.php?user=$1 [nc]
RewriteRule ^my_accountmyaccount.php [nc]
#Pages
RewriteRule ^page/([0-9]+)/(.*)view_page.php?pid=$1 [nc]
#
#Miscellenous
RewriteRule ^search/result/?$search_result.php [nc]
RewriteRule ^upload/?$upload.php [nc]
RewriteRule ^contact/?$contact.php [nc]
RewriteRule ^categories/?$categories.php [nc]
#Group Section
RewriteRule ^group/([a-zA-Z0-9].+)view_group.php?url=$1&%{QUERY_STRING} [L]
RewriteRule ^view_topic/([a-zA-Z0-9].+)_tid_([0-9]+)view_topic.php?tid=$2&%{QUERY_STRING} [L]
RewriteRule ^groups/(.*)/(.*)/(.*)/(.*)/(.*) groups.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^groups/([0-9]+) groups.php?page=$1 [L]
RewriteRule ^groups/?$ groups.php [L]
RewriteRule ^create_group create_group.php [L]
#Collection Section
RewriteRule ^collections/(.*)/(.*)/(.*)/(.*)/(.*) collections.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^collections/([0-9]+) collections.php?page=$1 [L]
RewriteRule ^collections/?$ collections.php [L]
RewriteRule ^photos/(.*)/(.*)/(.*)/(.*)/(.*) photos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^photos/([0-9]+) photos.php?page=$1 [L]
RewriteRule ^photos/?$ photos.php [L]
RewriteRule ^collection/(.*)/(.*)/(.*)view_collection.php?cid=$1&type=$2&%{QUERY_STRING} [L]
#Photo Section
RewriteRule ^item/(.*)/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L]
RewriteRule ^photo_upload/(.*) photo_upload.php?collection=$1 [L]
RewriteRule ^photo_upload/?$photo_upload.php [L]
#
RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup/?$ signup.php
#Error Pages
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
### 3. SIMPLE BLOCKS REDIRECT - OLD SCRIPT ###
#--------------------------------------- SOME SIMPLE BLOCKS -----------------------------#
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteCond %{QUERY_STRING} SELECT(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} UNION(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteRule ^(.*)$ index.php [F,L]
#--------------------------------------- END BLOCKS -------------------------------------#
### END SIMPLE BLOCKS REDIRECT - OLD SCRIPT ###
########## End - Rewrite rules For SEO urls ######################
RewriteRule ^rss$ rss.php [nc]
RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING} [nc]
########## End - Rewrite rules For SEO urls ######################
RewriteRule^([a-zA-Z0-9-]+)/?$ view_channel.php?uid=$1&seo_diret=yes [NS]
when I tested it, in its original rule, the page will go to a 404 error trying case sensitive variations.
item/(.*)/(.*)/(.*)/(.*)