I would like to change urls from:
http://subdomain.domain.com/page/
to http://subdomain.domain.com/?page=pagename
and also:
http://domain.com/page/
to http://domain.com/?page=pagename
though haven't had much success.
Here is my htaccess file so far [updated]
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
# Remove 'www'
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Add slashes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://resolutiongaming.com/$1/ [L,R=301]
# Subdomain redirect
RewriteRule ^/(webdev)/(.*)$ http://webdev.resolutiongaming.com/$1 [R=301,L]
RewriteRule ^/(artwork)/(.*)$ http://artwork.resolutiongaming.com/$1 [R=301,L]
RewriteRule ^/(music)/(.*)$ http://music.resolutiongaming.com/$1 [R=301,L]
# Search engine optimization
RewriteRule ([a-zA-Z]+)/$ ?page=$1
I used RewriteRule ^([a-zA-Z]+)/$ ?page=$1
which seemed to work for the domain url but not the subdomain. Any help would be appreciated.
So it was an easy fix really. I basically put a .htaccess file in each subdomain directory that looks like this:
Hope this helps someone. :D
Actually had to do something like this recently. Try this for your Subdomain redirect block:
Or maybe this; note the change from $2 to $1:
EDIT: Or Maybe try this. Note that you need to capture two parts of the URL to rewrite as you are explaining. Each item in parenthesis
(
and)
corresponds to a string in the rewrite. Try this. Using your nicer regular expressionRewriteRule
as you mention in the comments:Or maybe this: