So by default the index.php is in the public directory. I want to rewrite the url so that abc.com/public/ becomes abc.com/ ??  I am very new to url rewriting ..
16372
This question is here so we can offer users who are looking for information on how to make one or more common or basic redirects in Apache using the htaccess file. All future questions pertaining to finding information that is that is covered by the question should be closed as a duplication of this question. .  Whats the point in this question? The idea while not perfect is catch the most commonly asked questions regarding redirects using the  htaccess on the Apache platform either on  some type of lamp or a live server. The type of answers should be generally those that you could imagine are used by 100,000’s of sites world-wide and are constantly asked here at Pro Webmasters repeatedly over and over in various forms.  A few examples of the type of answers we are looking for:   How can I redirect non-www to www? How can I redirect a sub domain to the main domain? How can I redirect a sub folder from domain to a root or a subdomain?  How can I redirect an old URL to a new URL?   A few examples of the types of answers that we are not looking for:   Answers that do not involve a redirect. Any answers relating to NGinx, IIS or any other non-Apache platform. Answers that involve custom and complex string or query removals.   Resources for Advanced to Complex Mod_Rewrite Rules:      Please note: that this question is still in construction and may need some refining either by myself or a real moderator of Pro Webmasters, if you have any concerns or questions .
76243
How do I create subdomain like  ? Do i have to access htaccess somehow? Is it actually simply possible to create it via pure php code or I need to use some external script-server side language?  To those who answered: Well, then, should i ask my hosting if they provide some sort of DNS access??
45567
Does it make any difference to SEO ratings what-so-ever if your url has a trailing slash:  http://www.example.com/some/slug/paths/   as opposed to one that does not:  http://www.example.com/some/slug/paths
84929
If I do pwd I notice it uses whatever symlinks I used to get into the current directory.  Can I get it to tell me the "real" directory I'm in ... i.e. the path from the root to my current directory without the use of any symlinks?
6697
I recently submitted a sitemap.xml in Google's Webmaster Tools and some of the pages already got indexed. The problem now is, that I cleaned my URLs with MOD_REWRITE in the .htaccess file afterwards and I would like the new ones to be indexed. The old ones should be removed from the Google Index.  Indexed Page:  www.example.com/article.php?=article=this%is%an%example   New URL:  www.example.com/article-this-is-an-example   Do I even have to remove them manually from the index in any way or do they refresh if Google crawls my new sitemap? I really wan't to prevent duplicate content.  Thanks in advance.
26690
Other than for historical reasons, is there is reason to have “www” in a URL?  Should I create a permanent redirect from www.xyz.com to xyz.com, or from xyz.com to www.xyz.com? Which one would you suggest and why?
35684
I have this in my .htaccess (modified from the default Drupal .htaccess):  RewriteCond %{HTTP_HOST} ^www\.website.com\.com$ [NC] RewriteRule ^(.*)$ http://website.com/$1 [L,R=301]   In theory this will redirect something like http://www.website.com/asdf to http://website.com/asdf. However, it doesn't redirect, it allows requests to go through like there was no redirect intended.  (I'm on OS X if it matters, but I've also tried it on a Network Solutions Linux server with the same result.)
86684
A user of ours cleared their path, thanks to some directions on the internet.  What is the default path, I am a developer so I have tons of extra stuff in mine, what should my user get on a plain jane one?
69356
Maybe I'm making this way more complicated than I need to, but I want to serve my Drupal site that I've installed at example.com/drupal from example.com.  This particular site is an add-on site on my shared host, so the actual file structure is public_html/example.com/drupal.  What do I need to modify: .htaccess or add a redirect in cPanel?  I can't imagine I'm doing anything radical here, but there's no clear-cut answer in all my searching.
48876
I want to redirect only my root to another url, but maintain all the /sub/directories where they belong (and redirect)  example:  mysite.com/1 redirects to somewhere mysite.com/admin opens a page  i want mysite.com/ to redirect to mysecondsite.com and only this with a 301 redirect using htaccess
19499
I have a WordPress installation that is not redirecting URLs not starting with www.  Example: http://example.com/dir/ doesn't send to http://www.example.com/dir/ instead goes to http://example.com/.  How do I change the .htaccess below to always redirect to the page either using www or not?  # BEGIN WordPress RewriteEngine On  RewriteBase / RewriteRule ^index\.php$ - [L]  # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]  # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]  RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]  # END WordPress
43257
You can make a catch-all rewrite rule for apache that acts somewhat like an alias, but can be implemented in a .htaccess file while an alias can't.  As an example, assuming your document root is a hierarchy like this:  /.htaccess /test/ /test/.htaccess /test/file   You can "Alias" all requests to the test folder by making the root .htaccess contain:  RewriteEngine On RewriteRule ^(.*)$ /test/$1 [L]   And the second .htaccess contain:  RewriteEngine On   This works great, and usually is all you need. It just has one problem - it creates multiple valid urls. Now you can access the file with both /file and /test/file.  Ordinarily this isn't a problem, but if you add a file called /test/test you'll see the problem, as the fake alias stops working entirely. If the subfolder has a complex .htaccess of its own it can cause major headaches.  Is there any way to fake an alias from a .htaccess without the original urls still working? (Any RewriteCond for the subfolder that would check if we've already been rewritten or not?)
80272
I want to know, is there a huge difference in terms of SEO between these URLs:  example.com/ontario/toronto/listings   or  example.com/listings.php?p=ontario&amp;c=toronto   Will one URL rank higher than the other? Is there a huge difference here?
88597
I'm using this .htaccess that pass everything after URL to $param, so example.com/news/id goes to PHP as $_GET['param']='news/id'. But Nginx is always throwing me to 404 page.  My .htaccess:  RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule  (.*) index.php?param=$1    What I tried in Nginx default.conf:   server {         listen 80;         listen [::]:80;     server_name domain.com;         root    /var/www/html;          location / {                 if (!-f $uri){                         set $rule_0 1$rule_0;                 }                 if (!-d $uri){                         set $rule_0 2$rule_0;                 }                 if ($rule_0 = "21"){                 rewrite ^(.*) index.php?param=$1;                 }         } }
124126
Hi i have recently moved my forum from Mybb to Vanilla, so the index pages such as showthread.php now do not exist. This is a big problem for SEO, what do I do to redirect this to the home page?
20630
Is there a mod_rewrite equivalent for IIS 7.0 that's   a) more or less complete   b) suitable for a production environment, i.e. battle-tested/dependable/secure  Do you have an experience-based recommendation?
112581
We're launching new website with new url structure and new content. Domain is the same. Many old pages are indexed by google. Should I use 404 or 301 and redirect to '/' for these old resources? I also want to remove these pages from google index.