Forum Moderators: phranque
my current .htaccess file is as follows:
ErrorDocument 403 /index.php?do=/public/error/403/
ErrorDocument 404 /index.php?do=/public/error/404/
RewriteEngine On
RewriteRule ^arcade/gamedata/$ /file/arcade/gamedata/ [L]
RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/googlec690f31bbc06856f.html
RewriteRule ^index.php(/.*)$ /index.php?do=$1 [L]
RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/googlec690f31bbc06856f.html
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} !^/robots.txt
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteRule ^(.*)$ /index.php?do=/$1 [L]
What do i need to change in there to make my urls show up in this fashion http://user.example.com/
any help with this is greatly appreciated.
[edited by: jdMorgan at 2:07 pm (utc) on May 26, 2009]
[edit reason] example.com [/edit]
If you want to change "what shows up" then you must change the link on your page.
Then use mod_rewrite to "connect" the new link URL with the correct filepath using an internal rewrite (not an external redirect),
Finally, and as an optional last step only, redirect direct client requests (only) for the old URL to the new URL in order to recover pagerank and traffic from old bookmarks and links on other sites.
Side note: For use in .htaccess, you code could be made more efficient by use of the "local OR". For example,
RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/(file¦install¦design¦plugins)/
RewriteCond $1 !^(file¦install¦design¦plugins)/
The exclusion RewriteConds on your second rule appear to be wholly unnecessary, since none of those URL-paths will match rule pattern of "^index.php(/.*)$"
Jim
Links on pages are what define URLs. A URL is seen to 'exist' as soon as you create a link on a page with something in the 'href' part of it. It is that entry that is stored in a SE links database.
Only when that link is clicked by a user, or when the SE bot requests that URL directly, and the request hits the server, do we actually get to find out whether it returns 200, 301, 302, 307, 403, 404, 503, or some other status code within the HTTP Header. If the URL is blocked by robots.txt the status will forever remain unknown to the bot. That's because it will not be able to send that URL request to the server.
Only a URL returning '200 OK' will be indexed with content. Other status codes will force the bot to do other things.
A redirect tells the browser requesting the old URL to make a new request for a new URL.
A rewrite connects an external URL request with an internal filepath/file; one that is different to that initially suggested by the path part of the original URL request, without revealing what the internal path and file actually are.
RewriteCond %{HTTP_HOST} ^([^.:]+)\.example\.com\.?(:[0-9]+)?$
RewriteRule ^$ /index.php?do=/%1 [L]
You may wish to exclude the "www" subdomain from being rewritten by adding an additional RewriteCond at the top:
RewriteCond %{HTTP_HOST} !^www\.example.com [NC] Jim