Absurde rewrite

Using a single web hosting account to host multiple sites

Postby Kian » Thu Sep 10, 2009 8:09 am

Nothing to do with proxy. I also asked my hoster and they told me to find another way to rewrite the url because i can't open a directory from a file placed in another directory.

"Operation not permitted in /var/www/vhosts/domain.tld/subdomains/forum/httpdocs/index.php on line 1"

Now i really don't know what to do... my only idea is to copy the entire website in all subdomains but it's inefficent.
Kian
 
Posts: 11
Joined: Mon Sep 07, 2009 5:45 am

Postby richardk » Thu Sep 10, 2009 2:26 pm

Nothing to do with proxy.

You can't or you don't want to? Proxying can be a solution to this problem.

Now i really don't know what to do... my only idea is to copy the entire website in all subdomains but it's inefficent.

That may be your only solution. Or, you could not use sub domains.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Kian » Sun Sep 13, 2009 4:31 pm

Finally the main problem was solved :D I can now use Aliases. It's working fine with the rewrite rules you posted in this topic. I've only one problem.

I can rewrite with no problems urls like in the following example

domain.tld/index.php?site=forum --rewrite--> forum.domain.tld
domain.tld/index.php?site=articles --rewrite--> blog.domain.tld
domain.tld/index.php?site=files --rewrite--> download.domain.tld

Code: Select all
Options +FollowSymLinks

RewriteEngine On

# forum.example.com --> /index.php?site=forum
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^forum\.domain\.tld$ [NC]
RewriteRule ^$ /index.php?site=forum [QSA,L]

# blog.example.com --> /index.php?site=article
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^blog\.domain\.tld$ [NC]
RewriteRule ^$ /index.php?site=articles [QSA,L]

# forum.example.com --> /index.php?site=forum
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^download\.domain\.tld$ [NC]
RewriteRule ^$ /index.php?site=files [QSA,L]


This is the problem: let's suppose that i'm in forum.domain.tld. When i click on "Articles" or "Download" links (index.php?site=articles/files) i'm not redirected to blog.domain.tld and download.domain.tld. I'm always in forum.domain.tld. I want to ask you if i can set a rewrite rule to switch the subdomain or if i need to edit the links in the website. Example:

Article: domain.tld/index.php?site=articles --edit--> blog.domain.tld
Download: domain.tld/index.php?site=files --edit--> download.domain.tld

What is the best way in your opinion?
Kian
 
Posts: 11
Joined: Mon Sep 07, 2009 5:45 am

Postby richardk » Sun Sep 13, 2009 4:51 pm

I want to ask you if i can write a rule to switch subdomain or if i need to edit the links in the website:

Article: domain.tld/index.php?site=articles --edit--> blog.domain.tld
Download: domain.tld/index.php?site=files --edit--> download.domain.tld

What is the best way in your opinion?

You should edit the links in your website, you don't what to waste time redirecting constantly. And search engines probably won't appreciate the redirects either.

You can redirect (for old links on other sites and bookmarks) as well
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?site=articles(&.*)?$ [NC]
RewriteRule ^index\.php$ http://blog.example.com/ [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Kian » Sun Sep 13, 2009 6:52 pm

Thank you, i will code the entire website manually... now i think that this is my last question :)

I've read many article about url rewrite seo friendly including the guide you linked me: http://forum.modrewrite.com/viewtopic.php?p=11041#11041 but i don't understand how to query the database with mod rewrite :o Example:

Database >>> forum_board

FIELD------[ID]---[Title]-----------[Post]------------------------------
RECORD---[8]----[New York]----[New York is a beautiful city]--

Now i have the query url http://domain.tld/index.php?site=forum_topic&topic=8. How can i rewrite the url in this way? http://domain.tld/New_York-8.html ?
Kian
 
Posts: 11
Joined: Mon Sep 07, 2009 5:45 am

Postby richardk » Mon Sep 14, 2009 10:21 am

You would either need a RewriteMap or to do the redirect with PHP.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Domain Handling

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron