27 votes
Accepted

Same Arabic phrase encoding into two different urls, why? How to handle?

The difference comes from normalization. I know nothing about Arabic language but if I use both strings in a Unicode viewer, the difference starts right at the left part of the string. First string is ...
11 votes
Accepted

.htaccess rewrite URL leads to missing CSS

Not being able to find your JavaScript and CSS files is a client-side/browser issue related to your URL-path, it's not something that should be fixed in .htaccess (at least not in this case) - ...
  • 42k
9 votes
Accepted

Is a trailing slash appropriate before URL parameters?

All four of your URLs are different for SEO: http://www.example.com/product http://www.example.com/product/ http://www.example.com/product?source=googleps http://www.example.com/product/?source=...
6 votes
Accepted

Can rewriterules work without carets or dollar signs?

You are using the ^ and $ (anchors in regex speak) because you are matching the whole URL, which is what most people want to do, so this is the most common example you see. If you omit the ^ and/or $ ...
  • 42k
6 votes
Accepted

Which is more SEO friendly, redirect or rewrite?

It generally makes little difference. A 301 redirect may cause a short term drop in ranking, but nothing to worry about. An internal rewrite keeps the same URLs. You just need to be careful that you ...
  • 1,617
4 votes

How is a slash in the URL path interpreted by search engines?

Search engines see both dashes and slashes as word separators, so they will be able to parse either of your URLs. Traditionally slashes in URL paths represent directory structures. Because of this, ...
4 votes
Accepted

Will http to https rewrite rule affect SEO ranking?

Yes, it will. The http and https version will be seen as individual pages and thus also create duplicate content. The solution is to use a 301-permanent redirect, which your code does. This will ...
  • 6,776
4 votes

"There is no subdomain here." error in creating (one/multi)-level sub-domains

The software 'WebsitePanel' does not allow you to make subdomains of a subdomain. You could use a sub-domain to create a new web site, but you cannot create another sub-domain based on it. From ...
4 votes
Accepted

.htaccess rewrite with % in query string doesn't work

Note that if you need to match against the query string, you need to compare against the QUERY_STRING server variable in a mod_rewrite RewriteCond directive. You can't match against the query string ...
  • 42k
4 votes
Accepted

Have Apache show 404 at missing page URL instead of redirecting to error page URL

Apache server can be configured to show the error page at the error URL, or it can redirect to the error page. It is almost better to show the error page directly at the URL rather than redirecting ...
4 votes
Accepted

rewrite url - remove trailing / if any and add .php

I assume you want to remove the trailing slash (if any) with an external redirect in order to canonicalise the URL and then append the .php extension with an internal rewrite (ie. hidden from the user)...
  • 42k
4 votes
Accepted

Enabling Multiviews is how you make a web server able to open links with missing extensions?

tl;dr Yes, you can enable MultiViews to serve extensionless URLs. ie. Where the file extension is omitted from a URL that would otherwise map to an existing file. However, be aware of potential ...
  • 42k
4 votes

How do I use URL redirection with reverse proxy?

Under Apache, using the ProxyPassReverse directive will do what you want. It will take the redirect from the backend server and replace the backend host name with the front end name. From the ...
4 votes
Accepted

NGINX - Rewrite .js.php file to .js

If the underlying filename is script.js.php then it doesn't make sense to rewrite this to script.js - as that would result in a 404. However, the directives you posted would seem to result in a 404 ...
  • 42k
4 votes
Accepted

Multiple rules to rewrite the url

Yes, you have a conflict. Both your .htaccess rules have exactly the same conditions, so the first one is always going to win. The second is never going to be executed. Your URL structure is ...
  • 42k
4 votes

Adding IDs to urls to open up namespace - SEO considerations?

If you correctly put in 301 redirects and update your sitemap, the site will be fine. However... What are you trying to gain from this change? The Stack Exchange-style hierarchy doesn't make sense ...
4 votes
Accepted

Why is this .htaccess evaluating to 302 redirect instead of internal rewrite?

Your rewrite rules use absolute URLs that include the protocol and host name. Internal rewrites only work with relative URLs that have just the path. When mod_rewrite encounters an absolute URL for ...
4 votes
Accepted

htaccess - URL Rewrite to rewrite specific URLs but allow one subdir URL

The mod_alias Redirect directive uses prefix-matching and everything after the match is copied onto the end of the target URL. You can use RedirectMatch (which uses a regex as opposed to simple prefix-...
  • 42k
3 votes

How do I implement URL rewriting in my .htaccess file?

As addition to above answers one can use RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^([\w-]+)$ $1.html [L] ([\w-]+) Allows letters, ...
3 votes

Links on Google result list with unnecessary parameters

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 ...
  • 186
3 votes

Properly force SSL with .htaccess, no double authentication

This works perfect for what I'm trying to do, I have some PHP based admintools in respective directories under /admin/, in /admin/.htaccess I have listed: SSLOptions +StrictRequire SSLRequireSSL ...
  • 31
3 votes
Accepted

Redirect to other folder but get URL appear the same

Rewrites are what you're looking for as long as you don't redirect (the R flag): # placed under root, ie /.htaccess <IfModule mod_rewrite.c> RewriteEngine on # to prevent infinite ...
3 votes

Is a trailing slash appropriate before URL parameters?

Regarding the SEO, I wouldn't expect it to be an issue, as Google have enough common sense to realise that, if the two URLs you have shown returned the same content, that for all practical purposes ...
3 votes
Accepted

"There is no subdomain here." error in creating (one/multi)-level sub-domains

The approach of using a wildcard DNS record is probably the correct one for your use case. When you configure a wildcard DNS record, all requests to any subdomain will be resolved to the IP address ...
3 votes
Accepted

Do we have any redirect solution for all of subURL?

You want to do a blanket redirect from one domain to another. Assuming Apache, put in your .htaccess file in the root directory of example0.com: RewriteEngine on RewriteRule ^(.*)$ http://www....
  • 32.7k
3 votes
Accepted

redirect various http domains to certain https domain via htaccess

With your additional domains pointing to subdirectories off the main domain's document root, you can add the following to the .htaccess in that subdirectory to redirect to the main domain: ...
  • 42k
3 votes

Writing clean urls with .htaccess

SOLVED! Thanks to you guys. Solution: # Turn Rewrite Engine On RewriteEngine on # Set the base to /games/ so we need not include it in the rules RewriteBase /games/ #Rewrite for achilles.php?...
  • 81
3 votes

nginx location rewrite: match /{?x}, {y}, {?z}. Remove y

If the URL contains a / followed by any characters or none followed by a / followed by sitename followed by any characters or none, remove sitename: rewrite ^(.+)/sitename(/.*)$ $1$2; ...
3 votes
Accepted

Is a real http to htttps rewrite possible or is this always going to be a redirect?

...does that mean that all http to https "rewrites" are actually redirects? Yes. They are external redirects, not internal rewrites. But rewrite does all the changes server side and are invisible ...
  • 42k
3 votes

Rewrite and hide page ID from URL

In your case, use actual event names instead of ID numbers as unique values both in the URL and any database you are running in the back-end of your website. Your rewrite rule probably (assuming your ...

Only top scored, non community-wiki answers of a minimum length are eligible