url-rewriting

How to remove a URL's trailing slash in a Rails app? (in a SEO view)

孤者浪人 提交于 2019-12-05 08:54:30
In order to avoid content duplication, I would like to avoid the pages of my site being accessible by several URLs (with or without trailing slash). Currently, the URLs catalog/product/1 and catalog/product/1/ lead to the same page. My goal is that the second URL redirect to the first (redirection 301, of course). None page of my site should be accessible with a trailing slash, except my home page / obviously. What is the best way to do this? Using .htaccess or routes.rb? How would you do that? NB: I'm developing with Ruby on Rails 1.2.3 I'd use Apache's mod_rewrite . Try this: RewriteEngine

Azure CDN rules engine to add default document EXCEPT for files requested by the site

点点圈 提交于 2019-12-05 08:51:23
I am using Azure Verizon CDN to publish my web application (an SPA) from Blob storage. I've successfully set up a custom domain and SSL. I've added a rewrite rule in the CDN to redirect to the default document index.html. Basically, this takes the incoming request and inserts "index.html" between the URL path and any query strings. So mydomain.com/startup goes to mydomain.com/startup/index.html mydomain.com/homepage goes to mydomain.com/homepage/index.html and mydomain.com/showuser/?userId=xxxxx goes to mydomain.com/showuser/index.html/?userid=xxxxx Which all seems to work well. Existing rule

URL Rewrite - Remove .html extension

北城余情 提交于 2019-12-05 08:22:20
So the idea is to remove the .html extension from each page like so... www.website.com/File.html > www.website.com/File www.website.com/Folder/File.html > www.website.com/Folder/File Now I've managed to do this using a URL Rewrite, but it means having to write a rewrite for each page, which is time consuming, not efficient and impractical say if the website is more than 20 pages. Is there a way to do this by writing just one or two rewrites in the web.config? This solution worked for me in the end: <rule name="RedirectUserFriendlyURL1" stopProcessing="true"> <match url="^(.*)\.(.*)$" />

Wordpress Custom URL Rewrites

坚强是说给别人听的谎言 提交于 2019-12-05 07:22:05
问题 I have links in my site that pass queries to pages that query from an external database. This works fine e.g. mysite.com/catalog/?tl=flooring however i want to rewrite this url to appear as mysite.com/catalog/flooring Ive tried modifying the rewrite rules in wordpress but it always displays the index page add_filter('rewrite_rules_array','wp_insertMyRewriteRules'); add_filter('query_vars','wp_insertMyRewriteQueryVars'); add_filter('init','flushRules'); // Remember to flush_rules() when adding

IIS url rewrite - css and js incorrectly being rewritten

血红的双手。 提交于 2019-12-05 07:19:43
Having an issue with my urlrewrites - anytime I point to a page that is to be rewritten it fails to display because it is also applying the rule to the css & js files that are referenced within my webpage. To try and remedy this I put in a fully qualified path to the css and js - this renders fine on any page where the rewrite isnt applied yet when i try to access a rewritten page the browser hangs. Has anyone encountered something similar and if so have you a solution? Appreciate any help. Tried looking on the site at similar issues but none have helped so far. <rewrite> <outboundRules> <rule

IIS URL Rewrite Rules

左心房为你撑大大i 提交于 2019-12-05 06:24:08
I have a AngularJS application that utilizes URL Rewriting for linking. My rewrite rule looks like : <rewrite> <rules> <rule name="MainRule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="Pattern" pattern="^api/(.*)" negate="false" /> </conditions> <action type="Rewrite" url="Default.cshtml" /> </rule> </rules> I found this solution on SO: How do I configure IIS for URL

.htaccess rewriting with the [P] proxy flag

[亡魂溺海] 提交于 2019-12-05 06:08:23
I am trying to do an invisible (transparent ?) rewrite via .htaccess and the proxy flag. It works with the [R] flag but not with the [P] flag because it just gives a 500 error. The two domains are on separate servers and the mod_proxy module is enabled. Is my .htaccess correct? Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} =one.com RewriteRule ^(.*)$ http://two.com/$1 [P] If mod_proxy was compiled as a shared module, it requires that you explicitly load the relevant submodules too. It's possible that on your server mod_proxy_http is not enabled, which leads to

How to create Virtual Host from Apache .htaccess?

醉酒当歌 提交于 2019-12-05 04:55:29
I am using Apache Friends XAMPP in Windows (Local Server). I setup the virtual host in httpd-vhosts.conf in an Apache configuration directory like this NameVirtualHost *:80 <VirtualHost *:80> ServerName test.example.com DocumentRoot "E:\xampp\htdocs\example" </VirtualHost> This works fine when I browse the URL http://test.example.com Is it possible to create virtual host from Apache .htaccess dynamically? The context for VirtualHost has to be server config . See the Apache docs . This means that the directive may be used in the server configuration files (e.g., httpd.conf), but not within any

how to rewrite a url with two variables using .htaccess

帅比萌擦擦* 提交于 2019-12-05 04:35:34
问题 i want rewrite it with a .htaccess i have this url: ../index.php?page=details&id=123456 like this: ../detail/123456 but I do not really know how to do this. Could you help me to rewrite this url? or give me a simple example that I can understand how it works 回答1: This should work: RewriteEngine On RewriteRule ^detail/([^/]*)$ /index.php?page=details&id=$1 [L] 回答2: RewriteRule ^(.*)/([0-9]+)$ index.php?page=$1&id=$2&%{QUERY_STRING} The first (.*) selects any string, e.g. "details". ([0-9]+)

Using .htaccess to redirect from one domain to another

会有一股神秘感。 提交于 2019-12-05 04:30:59
问题 I recently purchased a new domain for my WordPress site and I want to redirect anyone who visits using an old domain to the new one. I haven't moved servers, just added a new domain. For instance, if they went to either of these: http://www.example.net/some-article/ http://example.net/some-article/ Then I'd like them to be redirected to the appropriate URL: http://www.example.com/some-article/ http://example.com/some-article/ How would you do this simple .net -> .com redirect with a .htaccess