Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

.htaccess: Difference between revisions

From Randomness wiki
Created page with " <syntaxhighlight lang="Apache"> RewriteEngine On RewriteBase / # Ignore if file exists RewriteCond %{REQUEST_FILENAME} !-f # Ignore if directory exists RewriteCond %{REQUEST_FILENAME} !-d # Redirect if old w short path RewriteRule ^w/(.*)$ /$1 [R=301,L] # Redirect if old wiki path RewriteRule ^wiki/(.*)$ /$1 [R=301,L] # Sitemap moved fix RewriteRule ^sitemap.xml*$ mediawiki/sitemap.xml [L,QSA] # Root path rewrite to main page RewriteRule ^$ mediawiki/index.php [L,QSA]..."
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
RewriteBase /
RewriteBase /


# Ignore if file exists
RewriteCond %{REQUEST_FILENAME} !-f
# Ignore if directory exists
RewriteCond %{REQUEST_FILENAME} !-d
# Redirect if old w short path
# Redirect if old w short path
RewriteRule ^w/(.*)$ /$1 [R=301,L]
RewriteRule ^w/(.*)$ /$1 [R=301,L]
# Redirect if old wiki path
# Redirect if old wiki path
RewriteRule ^wiki/(.*)$ /$1 [R=301,L]
RewriteRule ^wiki/(.*)$ /$1 [R=301,L]
# Sitemap moved fix
# Sitemap moved fix
RewriteRule ^sitemap.xml*$ mediawiki/sitemap.xml [L,QSA]
RewriteRule ^sitemap.xml*$ mediawiki/sitemap.xml [PT,L,QSA]
 
# Root path rewrite to main page
# Root path rewrite to main page
RewriteRule ^$ mediawiki/index.php [L,QSA]
RewriteRule ^$ mediawiki/index.php [PT,L,QSA]
 
# Ignore if file exists
RewriteCond %{REQUEST_FILENAME} !-f
# Ignore if directory exists
RewriteCond %{REQUEST_FILENAME} !-d
# Root path plus anything rewrite to article
# Root path plus anything rewrite to article
RewriteRule ^([^/]*)$ mediawiki/index.php?title=$1 [L,QSA]
RewriteRule ^(.*)$ mediawiki/index.php?title=$1 [L,QSA]
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 23:45, 15 September 2024

RewriteEngine On
RewriteBase /

# Redirect if old w short path
RewriteRule ^w/(.*)$ /$1 [R=301,L]

# Redirect if old wiki path
RewriteRule ^wiki/(.*)$ /$1 [R=301,L]

# Sitemap moved fix
RewriteRule ^sitemap.xml*$ mediawiki/sitemap.xml [PT,L,QSA]

# Root path rewrite to main page
RewriteRule ^$ mediawiki/index.php [PT,L,QSA]

# Ignore if file exists
RewriteCond %{REQUEST_FILENAME} !-f
# Ignore if directory exists
RewriteCond %{REQUEST_FILENAME} !-d
# Root path plus anything rewrite to article
RewriteRule ^(.*)$ mediawiki/index.php?title=$1 [L,QSA]