url-rewriting

Apache mod_rewrite - prefer files over directories with pretty URLs

拟墨画扇 提交于 2019-12-30 07:43:26
问题 I want to have pretty urls so http://www.domain.com/foo will return http://www.domain.com/foo.php The issue is that there is a directory that has the same name. I have another page at http://www.domain.com/foo/bar/baz and right now my server just returns the directory listing of foo when I request http://www.domain.com/foo Pseudocode: If the request plus ".php" is a file rewrite out the file instead of the directory Actual Code: RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME}\

IIS URL Rewrite for redirect to FQDN

倖福魔咒の 提交于 2019-12-30 06:55:24
问题 I am trying to figure out the best URL rewrite rule to accomplish the following. http://intranet/sites/default.aspx rewrite to http://intranet.domain.com/sites/default.aspx http://intranet rewrite to http://intranet.domain.com Also in IIS the URL binding is set to "intranet" for that web application Hope that makes sense. Can someone please help with the rewrite rule? 回答1: This is the rule I would use: <rule name="Intranet redirect" stopProcessing="true"> <match url="(.*)" /> <conditions>

Is it possible to rewrite url using ColdFusion?

北战南征 提交于 2019-12-30 05:21:04
问题 I have got a requirement for generating user friendly urls.I am on IIS. My dynamic URLs looks like, www.testsite.com/blog/article.cfm?articleid=4432 Client wants the urls should look like www.testsite.com/blog/article_title I know this can be easily done using IIS URL rewiter 2.0. But the Client wants to do it using ColdFusion only. Basic idea he given like, User will hit the url www.testsite.com/blog/article_title I need to fetch the article id using the article_title in the url. Using the

How do I get the last segment of URL using regular expressions

安稳与你 提交于 2019-12-30 04:22:04
问题 I have a URL: www.domain.com/first/second/last/ How do I get the last term between slashes? i.e. last using regular expressions? Please note that the URL could just be: www.domain.com/last/ Or: www.domain.com/first/second/third/fourth/last/ I need to extract this last term for use in the Zeus Server's Request Rewrite module which uses PERL and REGEX. Update After implementing some answers, I have just realized that I need this match to be made only on URLs in a certain directory. i.e. www

Magento: Rewrites for deeply nested category pages

自作多情 提交于 2019-12-29 07:14:15
问题 We are doing some SEO optimizations on our Magento store front and I need some advice on the best way to change category urls. Our SEO contractors want to change a bunch of urls from: /base-cat/sub-cat1/sub-cat2.html to /seo-friendly-cat2.html. We have a bunch of nested categories (5 top-level and a bunch of sub categories up to 4 levels deep). Since this helps our customers drill down through the main navigation, we aren't sure if we want to change the category hierarchy. But we might be

ASP.NET - Building your own routing system

元气小坏坏 提交于 2019-12-29 06:35:36
问题 In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling in ASP.NET now, and I'm wondering if/how I might perform something similar. Is there a way to route all requests (similar to the way WordPress does it) to one page where central route processing is performed? I'm aware of the MVC framework

How to rewrite SEO friendly url's like stackoverflow

こ雲淡風輕ζ 提交于 2019-12-29 05:34:29
问题 If you go to a url like the following: http://stackoverflow.com/questions/9155602/ the address bar will be updated to http://stackoverflow.com/questions/9155602/redirect-existing-file-to-different-url-using-mod-rewrite . This is not done with JavaScript and not with a hard-refresh, my best guess is that it's done with mod_rewrite; however, how would it know the title of the article without server side processing with php? I just updated my site to use SEO friendly url's, it used to be /shows

RewriteCond to skip rule if file or directory exists

坚强是说给别人听的谎言 提交于 2019-12-29 04:44:18
问题 I am trying to adjust my htacess file to skip the rewrite rule if the file or directory exists, but when the file exists, it changes the URL to something different. I don't know why this is happening. Here is my htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^project/([^/\.]+)/?$ index.php?view=project&project=$1 [L] RewriteRule ^for/content/ag index.php?view=opening&section=ag [L] RewriteRule ^for/content/bus index.php

How do I configure JSF url mappings without file extensions?

折月煮酒 提交于 2019-12-29 04:02:45
问题 Most tutorials propose a default JSF configuration similar to the following web.xml: <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> <url-pattern>*.jsf</url-pattern>

Microsoft rewriting module - Force www on url Or remove www from url

流过昼夜 提交于 2019-12-29 03:29:49
问题 I have a shared hosting plan with Windows Server 2008 and IIS7.5, and there is Microsoft rewriting module installed and enabled. <rewrite> <rules> <rule name="myRule" patternSyntax="Wildcard"> <!--Rewriting code--> </rule> </rules> </rewrite> So, how to redirect mydomain.com/everywhere-in-site/my-page.html to www.mydomain.com/everywhere-in-site/my-page.html with Microsoft rewriting module? And what if I want to redirect www.mydomain.com/everywhere-in-site/my-page.html to mydomain.com