Tag Info

New answers tagged

1

For 20 links, you are not going to notice a speed difference with any of those methods. None of them are going to add significant overhead. There is significant overhead added by PHP and WordPress to run your site. The redirects are not going to impact performance at all. For a very large quantity of redirects (thousands), individual rewrite rules ...


0

The Redirect directive doesn't pay any attention to the current host name. Your intention of Redirect short.com/howto http://longdomain.com/tutorials/how-to-do-something appears to be to only redirect when the domain name is "short.com". mod_alias's redirect doesn't suport this syntax. The short.com/howto argument must only be a URI path ...


0

Why not set up a CNAME record from short.com pointing to longdomain.com and then, based on your examples, the incoming requests would work without any short.com .htaccess rules.


1

Should I still have dummy, low bandwidth (ie. 1px x 1px) .png files residing on the server under the names img1.png, img2.png, img3.png, even though the redirect means they will never actually be served on the page? No, these would serve no purpose, since your rewrite rules will always intercept requests to those URLs. Your solution, whilst ...


2

I saw a post about this on SO Webhoster inserts a javascript which brokes my code how to remove it? The chosen answer states: They have a link in their cPanel where you can disable the analytics code. http://members.000webhost.com/analytics.php Beware - by doing this you violate their policy and they will eventually drop you from their ...


0

Try: RewriteEngine on RewriteRule ^(gallery)\/(.+)$ http://website.com/$2 [R=301]


0

RewriteRule ^about/$ /test/about.php [L] RewriteRule ^about\.php$ /test/about/ [R,L] This is probably just your example, but this shouldn't actually result in a rewrite loop because of the additional /test subdirectory in the substitution. (/test/about.php won't match the pattern ^about\.php$) But anyway, assuming you want to (internally) rewrite ...


1

Here is the one simple answer for your issue. Just Sign in into your domain panel and redirect the new domain name instead of old domain name. In this case what happened is if anyone open the old website it automatically redirect to the new domain website.


1

You need to use the QSA flag on your rewrite rule. It preserves any query string from the original URL and appends it to the new URL. Your rewrite rule would be: RewriteRule ^(|/)$ index.php?url=$1 [QSA] RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?url=$1 [QSA]


1

Try <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /gallery/$1 [L] </IfModule>


2

You can remove it with URL Rewriting like that : <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /product.php/$1 [L] </IfModule> Place this code in .htaccess at root.


1

So after some trial and error I came up with a working solution that I'm not quite happy with. But at least it works. Since all "real" images are located in /includes/ or subdirectories I simply rewrote the rule for the images. So this location ~* \.(?:gif|jpe?g|png|ico)$ { expires 168h; add_header Pragma public; add_header Cache-Control ...


1

The source of your problem can be in html or in javascript, and you cannot control the links that other people put on the net too.. And because he finds a page when making a request for it, it indexes it. I miss some information to give answer with code (using a CMS? Other rules in .htaccess, etc…), but here are some ways : Write a permanent redirect in ...


1

It is not exactly the answer to your question but you should think twice about removing trailing slashes for directories. The doc about DirectorySlash warns from potential problems (a mess with relative urls and others). And you can save some headaches by only redirecting with a 301 /dir/index.html to /dir/ (nearly your point 3), and using DirectoryIndex ...



Top 50 recent answers are included