RewriteEngine On
# RewriteBase / # Commented out to work in subdirectories like /news/

# Article Rewrites
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^article/([^/]+)/?$ article.php?slug=$1 [L,QSA]

# Category Rewrites
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^category/([^/]+)/?$ category.php?slug=$1 [L,QSA]

# Poll Rewrites
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^poll/?$ poll.php [L,QSA]
RewriteRule ^poll/([^/]+)/?$ poll.php?slug=$1 [L,QSA]

# Tag Rewrites
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^tag/([^/]+)/?$ tag.php?slug=$1 [L,QSA]

# E-Paper Rewrites
RewriteRule ^digital-paper$ epaper.php [L,QSA]
RewriteRule ^digital-paper/view/([0-9]+)$ epaper_view.php?id=$1 [L,QSA]

# Magazine Rewrites
RewriteRule ^magazine$ magazine.php [L,QSA]
RewriteRule ^magazine/view/([0-9]+)$ magazine_view.php?id=$1 [L,QSA]
