Home Apache redirect to ignore folder
Reply: 1

Apache redirect to ignore folder

jeph perro
jeph perro Published in 2018-01-11 15:46:09Z

I have a self-hosted multi-site Wordpress instance. There are several different domains attached to this instance - but I don't like the way the URL looks.

So, the actual page URL looks something like this :


I would like people to click a link that looks like this, and for this URL to appear in the browser address bar :


I want apache webserver to redirect to


What would the mod_rewrite rule look like ? Should it appear near the top of the http.conf redirects, and be last?


KDjukic Reply to 2018-01-11 22:30:03Z

You will indeed want to use mod_rewrite.

All rewrite rules abide by the following format:

RewriteRule pattern substitution [flags]

You can decide to either place this directly in the <VirtualHost> directive of your httpd.conf, or into the .htaccess file depending on your setup.

RewriteEngine On
RewriteRule ^myblog/(.*)$ $1 [R=301,L]

This will remove myblog/ from your URL. The R=301 means that this will be a permanent redirect, and as such, the change will be reflected in the address bar. The L declares that this is the last rule, and any rules below will not be applied.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.353552 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO