rewriting URL from www.domain.com/wp to www.domain.com

New to mod_rewrite? This is a good place to start.

rewriting URL from www.domain.com/wp to www.domain.com

Postby lucadg » Sat May 30, 2009 6:06 pm

Hi All,
I have installed Wordpress Mu under
http://www.isoleandamane.com/isoleandamane.com
the folder is
public_html/isoleandamane.com

I prefer not to install it in the root (http://www.isoleandamane.com) , because it would mess up the whole server.
So, I need the rewrite the URL to look like
http://www.isoleandamane.com
instead of
http://www.isoleandamane.com/isoleandamane.com

and I know that URL rewriting can help.
I tried and tried but it seems quite hard, so I come here :)

WP has a permalink system and this is the .htaccess file:


#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>


I am sure there is a quick fix here, I am unaware of!
Thanks!

Bye

Luca
lucadg
 
Posts: 17
Joined: Sun May 25, 2008 11:29 pm

Rewrite

Postby psuhiker » Mon Jun 01, 2009 3:15 pm

This was a similar thing I did, and used the following:

RewriteCond %{HTTP_HOST} isoleandamane\.com
RewriteRule ^(.*)$ isoleandamane/$1 [L]
psuhiker
 
Posts: 3
Joined: Mon Jun 01, 2009 3:09 pm

Postby lucadg » Mon Jun 01, 2009 3:59 pm

thank you for the suggestion.
I tried it in my .htaccess in the wordpress installation and nothing changed.
The url stays
http://isoleandamane.com/isoleandamane.com/
I also tried to remove the other Wordpress rules but to no avail.
lucadg
 
Posts: 17
Joined: Sun May 25, 2008 11:29 pm

Postby richardk » Tue Jun 02, 2009 10:54 am

Have you set up a redirect from http://example.com to http://example.com/example.com?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/example.com%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^(.*)$ /example.com/$1 [QSA,L]

in your document root .htaccess file.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby lucadg » Tue Jun 02, 2009 6:04 pm

this is it!
The easy one I was dreaming about :)

I added it also to the .htaccess in the wp folder as links where broken.
Now all works, only one problem is left:
all internal links are
http://isoleandamane.com/isoleandamane. ... ategorized
instead of
http://isoleandamane.com/blog/archives/ ... ategorized

so, I need to get rid of the isoleandamane.com folder here.

Richardk, you rule as always!
lucadg
 
Posts: 17
Joined: Sun May 25, 2008 11:29 pm

Postby richardk » Wed Jun 03, 2009 12:31 pm

Are they that in the HTML source code? If they are, you need to change Wordpress's settings so it doesn't show up.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby lucadg » Sat Sep 05, 2009 7:46 pm

I forgot to reply.
All is fine, thank you again!
lucadg
 
Posts: 17
Joined: Sun May 25, 2008 11:29 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 31 guests

cron