Difference between revisions of "Rewriting with .htaccess"

From XMission Wiki
Jump to: navigation, search
(Created page with 'You can create your own rewrites for domains with an .htaccess file. Some of the most common rewrites are: Point an entire site to a different URL, such as domain.net redirected…')
 
 
Line 24: Line 24:
 
DirectoryIndex index.html
 
DirectoryIndex index.html
 
</pre>
 
</pre>
 +
 +
 +
[[Category:Troubleshooting]]

Latest revision as of 21:44, 27 January 2014

You can create your own rewrites for domains with an .htaccess file. Some of the most common rewrites are:

Point an entire site to a different URL, such as domain.net redirected to domain.com:

# This allows you to redirect your entire website to any other domain
Redirect 301 / http://example.com/

Redirect index.html to a specific subfolder:

# This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/

Redirect an old file to a new file path:

# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html

Redirect to a specific index page:

# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html