mod_rewrite not working on Magento installation - .htaccess

I've recently installed magento to a new server. The domain name has not been pointed to the server yet because I still need to design the site, so for now I'm using an IP address.
Example:
11.222.3.44/~clientname/
I'm trying to turn on magento's url rewrites to remove "index.php" after "/~clientname/" on every page, however when ever I turn rewrites on the site stops working and I get a 404. Would this be due to the IP address and the trailing client name I'm using? If so, how can this be corrected?
Any help is greatly appreciated!

Check if the RewriteEngine is On, RewriteBase is ok in the .htaccess. In your case it should be RewriteBase /~clientname/
And of course check that the mod_rewrite is installed and enabled but I think it's already done.

Related

.HtAccess rewriting: Direct www.X.com to www.Y.com/test, whilst still showing www.X.com in the browser

I have a domainname, www.X.com that redirects (using some magic from the webhosting-company from which I bought www.X.com) any user that visits www.X.com to www.Y.com/test.
This works fine, but what I would like to happen is for the URL to remain www.X.com after the redirect. Right now, after the redirect the users URL changes to www.Y.com/test.
I'm not sure if htaccess rewriting at www.Y.com can fix this issue, so I would like to know wether this is possible and if so, how do I implement it in my .htacces file?
Regards and thanks in advance,
Robert
Instead of using the redirect tool of your hosting provider. You have to configure your domain to point to your server with a DNS A record:
Domain Type target server
www.X.com. A x.x.x.x
www.Y.com. A x.x.x.x
In your server virtualhost or via your hosting provider you need to configure both domains to point to your website.
In your .htaccess file you need ton configure domain www.X.com to point to the test directory:
RewriteCond %{HTTP_HOST} ^www.X.com$
RewriteRule ^(.*)$ /test/$1
Problem was solved by clearing out my Chrome cache; The webhost-magic HAD done the trick. Thanks mr Rockett and mr Lemaitre for your time!

How to remove /~CpanelUserName from my .com domain url?

I just moved my website to VPS, but I noticed that it's adding my Cpanel username for some reason:
For Example: mysite.com/~CpanelUserName/articles/hello-world
I believe I have to do something to the .htaccess file
btw, I am using Drupal
Note: If I take out the ~CpanelUserName from the url, it does display the article
This should work for you
RewriteEngine On
RewriteRule ^USERNAME/(.*)$ /$1 [R=301,L]
Somehow this fixed itself when I uploaded an older mysql database backup. I checked my .htaccess file and it's the original, does not have the code #howlin provided. Seems like it was a database issue. Thanks #Howlin for trying to help. What caused this still remains a mystery.

.htaccess redirect to subdirectory on Verio windows server

I've been trying to get a website up an running on my work's servers using Verio windows server 2003 gold and they've been quite useless when it comes to helping me out.
All I'm trying to do is set up a Wordpress installation, which they apparently require to be in a subdirectory. This is done and I have it in domain.com/wp ready to go. At this point they recommend that I use an .htaccess file to redirect to that url, so as they just sent me basically an "About .htaccess" link, that was of no help.
Did some searching, found a couple options like this one:
http://www.site5.com/blog/apache/htaccess/redirect-to-blog/20090427/
and nothing I use seems to work, not even as a straight redirect. Just gives me a "Directory Listing Denied - This Virtual Directory does not allow contents to be listed."
I do want to mention I did enable URL Rewrite for IIS via ISAPI_Rewrite 3 in the control panel.
As I mentioned Verio support is useless and I can't seem to find anything searching that seems to help my situation.
So pretty much what I need is domain.com/wp to rewrite as domain.com so all links centered around it do the same (ie domain.com/about domain.com/contact)
Any help? Thanks
If I understand you correct you need your Wordpress application to be available from the root of your web site instead of /wp/ folder? Then please try following .htaccess:
RewriteEngine on
RewriteRule ^(?!wp/)(.*) /wp/$1 [NC]
By the way I think you could try simply copying /wp/ folder content to the root folder.

.htaccess not working in subfolder

I have a couple of sites that are currently under development and I've put them under a specific subfolder for clients/co-workers to view - "http://dev.staffanestberg.com/site-name/". I've run into some problems getting the sites working with .htaccess. I can reach the index page by typing in the url for a site folder but neither img/style/js/etc linking or page rewriting works. Looking for a solution to this, Apache's "RewriteBase" seems to be the most likely one, however I can't get it to work.
Tried
RewriteBase http://dev.staffanestberg.com/site-name/
RewriteBase /site-name
What would be the correct method?
Thanks in advance,
-Staffan
mod_rewrite’s RewriteBase directive does only apply to rewrites using RewriteRule. And that does only apply for requests that are sent to the server.
But if the requested URIs are already wrong, RewriteBase doesn’t do any help. What you could try instead is the HTML element BASE that set’s the base URI for the current document.

How can I redirect to a different domain without changing the URL in the address bar?

I want to redirect from:
domain1.com/photos
To:
domain2.com/photos
I want the URL in the address bar to still read:
domain1.com/photos
Is there a way to do this using only .htaccess?
Note:
My .htaccess file for domain1.com is currently completely blank.
No, there isn't a way to do this with .htaccess. Doing so would present a glaring security hole - imagine someone doing this with a bank's website!
If both are hosted on the same server, do this in your .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain1.com$
RewriteRule (.*)$ http://www.domain2.com$1 [P]
</IfModule>
If you own both domain1 and domain2, you could accomplish this through domain name forwarding. Check your domain name registrar (like godaddy.com) for the options.
No, you can not do it through htaccess file.
You could open an iframe in domain1.com/photos that shows the contents of domain2.com/photos. But then the url would never change from domain1.com/photos, even when you went to a different page in domain2.
What are you trying to do? It sounds very sketchy. Do you own both domains? Why would you want to duplicate the contents of one site at another address?
Why is this not possible? Seems like a reasonable task as long as your Apache has mod_proxy installed:
ProxyPass /photos http://domain2.com/photos/
http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypass
A way around it, if the page at domain.com/photos is a server side script, do an HTTP call and serve up the response.
In ColdFusion:
<cfhttp url="another.domain.com/photos">
<cfoutput>#CFHTTP.FileContent#</cfoutput>
They'll be an extra request, but it'll get you the output you want.
its impossible using htaccess file.

Resources