That's a good question. I'm really more concerned with the forum being easy for the search engines to index than keyword friendly. I suppose the home page of the forum should be /htdv-forum without the rest of the characters. Other than that, whatever you think is easiest. Your the pro here. I got this from an online tool. Options +FollowSymLinks RewriteEngine on RewriteRule -forum-(.*)-topic-(.*)-page-(.*)\.html hdtv-forum?forum=$1&topic=$2&page=$3 Your new URL would be: -forum-1-topic-16-page-1 Then I found out, for Wordpress, it has to go before the WP mod_rewrite. Well, I tried it and it does nothing.
RewriteRule ^\-forum\-(.*)\-topic\-(.*)\-page\-(.*)\.html$ hdtv-forum?forum=$1&topic=$2&page=$3 [L] I would get rid of the first - and hdtv-forum is probably missing a .php some where.
I tried that too. I've come to the conclusion that it doesn't matter what I put, there is simply no effect. I'm sure I have put some code that should have caused an error. It seems the rewrite is being ignored all together. The entire forum uses one wp page (not post) called hdtv-forum...hence the file name. Anyway, it's looking like I'll have to pay someone to figure this out. Thanks for your help. On the other hand, it looks like google is indexing the posts, so maybe I should just let it be.
Hi Nintendo, Good to see you are still fighting strong to help all of us out. Mod rewrite will always remain french to me A new problem. I have a forum in a subdirectory where the home page is redirected to a particular page. It works but the url looks ugly.... RewriteEngine on RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^mydomain/?$ http://www.mydomain.com/vault/index.php?action=main [R=302,L] RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^mydomain.com/index.php$ http://www.mydomain.com/vault/index.php?action=main [R=302,L] Code (markup): Want it to look like: http://www.mydomain.com and also take out the "vault" from all urls like: http://www.mydomain.com/vault/index.php?action=search http://www.mydomain.com/vault/index.php?board=2.0 and make it like: http://www.mydomain.com/search http://www.mydomain.com/board=2.0 Also the htaccess file is currently in the root directory for all domains. I can move that too. Please advice. Jack
You can't have both mydomain.com/search mydomain.com/board=2.0 cause apache will fight over which one the URL is going to. Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^$ vault/index.php?action=main [L] RewriteRule ^([^.]+)\-([^.]+)$ vault/index.php?$1=$2 [L] spits out mydomain.com/action-search mydomain.com/board-2.0 and domain.com is domain.com/vault/index.php?action=main
Thanks, will try that. But the first code for redirect as mentioned in my post is in the root.... so, where do i put these.... or do we combine and put all in a .htaccess in the domain root... or in the root of the subdirectory of the forum... Anxiously, Jack...
domain.com/.htaccess RewriteRule ^$ vault/index.php?action=main [L] makes mydomain.com look like vault/index.php?action=main You can't both redirect it and have it look like that or apache will go bonkers, unless if I think you have some some RewriteCond, and I'm a RewriteCond n00bie!!
Thanks, RewriteRule ^$ vault/index.php?action=main [L] - this one is working The following one isn't RewriteRule ^([^.]+)\-([^.]+)$ vault/index.php?$1=$2 [L] .... any changes or variations... I know about the rewritecond stuff..u told me earlier also Jack
Why not? Just match the second one first and add a "Last" flag then match the first. RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)-(.+)$ vault/index.php?$1=$2 [C,L] RewriteRule ^(.+)$ vault/index.php?action=$1 [L] I don't often use chaining so I'm not 100% that the above will work, so if it doesn't, use this: RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)-(.+)$ vault/index.php?$1=$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ vault/index.php?action=$1 [L] They should both do the following rewrites: example.com/vault/index.php?search to example.com/search example.com/vault/index.php?board-2.0 to example.com/board=2.0
Sorry krt, I tried both, but none of them are working... but thanks for your help ****************** Nintendo ! The first one of your codes which you gave: RewriteRule ^$ vault/index.php?action=main [L] is working well. I have removed the site redirection, now i need help for the second lots which are : A http://www.mydomain.com/vault/index.php?action=xxxxxx http://www.mydomain.com/vault/index.php?action=profile;u=1 http://www.mydomain.com/vault/index.php?action=profile;u=1;sa=showPosts http://www.mydomain.com/vault/index.php?action=profile;u=1;sa=notification http://www.mydomain.com/vault/index.php?action=calendar http://www.mydomain.com/vault/index.php?action=usercp http://www.mydomain.com/vault/index.php?action=search http://www.mydomain.com/vault/index.php?action=search;advanced;search= http://www.mydomain.com/vault/index.php?action=help http://www.mydomain.com/vault/index.php?action=help;page=registering (can be many things after action) Just want to take out the "vault/index.php?action=" part from the url and make it something like : http://www.mydomain.com/xxxxx AND ANOTHER VARIATION - (This is in the forum part) B http://www.mydomain.com/vault/index.php?board=2.0 http://www.mydomain.com/vault/index.php?topic=20 http://www.mydomain.com/vault/index.php?topic=10.msg47#msg47 Basically the structure is www.... /vault/index.php?xxxxx= So, I just want to take out this "/vault/index.php?xxxxx=" part fropm the URL. Now if A & B can be combined to one code fine, else it can be multiple. Thanks. ************************** EDIT: THIS INFO MAY HELP YOU: The last time a code worked for one of my php website in the same server is given below but this only re-wrote anythign which came after index.php like index.php/xxx. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\ HTTP/ RewriteRule ^(.*)index\.php?$ http://www.domain.com/$1 [R=301,L] Thought this might help **************************
What was I thinking?? I meant: example.com/search to example.com/vault/index.php?action=search example.com/board-2.0 to example.com/vault/index.php?board=2.0 BTW, when you copied my code, did you include a RewriteEngine On ? RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)-(.+)$ vault/index.php?$1=$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ vault/index.php?action=$1 [L] I tested the above to make sure and it is working
I've read the FAQ and tried messing about with what I'm attempting to do but I'm having no luck, so hopefully someone can help me out. I'm trying to do two things: 1) Redirect www.domain.com/* to www.domain.com/dir1/subdir/$1, excluding www.domain.com/dir2 dir3 etc. 2) Redirect *.domain.com to www.domain.com/dir1/subdir/$1, excluding www.domain.com, db.domain.com, file.domain.com. +Rep for a magical formula
turiel: RewriteBase / RewriteCond %{REQUEST_URI} !^/(dir1|dir2|dir3) RewriteRule (.*) dir1/subdir/$1 [R=301,L] RewriteBase / RewriteCond %{HTTP_HOST} ^(.+?)\..+?\. RewriteCond %{HTTP_HOST} !^(www|db|file)\. RewriteRule (.*) dir1/subdir/%1 [L] If you want redirects, use [R=301,L] instead of [L] Also, when using *.domain.com, note that this must first be enabled on the server, e.g. by using a server alias.
How to re-direct my request http://blog.mydomain.com/some/thing to http://www.mydomain.com/blog/some/thing
Do you have blog.mydomain.com setup as a subdomain? If not, enable it through your web host control panel or however else. mod_rewrite needed (in your .htaccess file): RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^blog\. RewriteRule (.*) http://www.mydomain.com/blog/$1 [QSA,R=301,L] Code (markup):