url-rewriting

Remove .php extensions with .htaccess without breaking DirectoryIndex

亡梦爱人 提交于 2019-12-17 03:18:07
问题 I have the following rewrite in my .htaccess file which removes the .php extension from files, converting for example so.com/question.php to so.com/question . RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] However this also breaks the default DirectoryIndex behaviour, in which just typing the directory will redirect to the index file in the folder, e.g. so.com/answer displays so.com/answer/index.php Simply combining the above code with DirectoryIndex

urlencoded Forward slash is breaking URL

倖福魔咒の 提交于 2019-12-17 01:45:34
问题 About the system I have URLs of this format in my project:- http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0 Where keyword/class pair means search with "class" keyword. I have a common index.php file which executes for every module in the project. There is only a rewrite rule to remove the index.php from URL:- RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

How can I remove file extension from a website address?

北城以北 提交于 2019-12-16 22:21:30
问题 I am designing a website. I want my website address to look like the following image: I don't want my website to look like http://something.com/profile.php . I want the .php extension to be removed in the address bar when someone opens my website. In other words, I want my website to be like: http://something.com/profile As a second example, you can look at the Stack Overflow website address itself. How can I get this done? 回答1: Just add an .htaccess file to the root folder of your site (for

How to handle special characters in web.config rewrite rule?

不问归期 提交于 2019-12-14 04:02:11
问题 I'm getting errors on my rewrite rules when the URL contains a special character: This URL http://www.example.com/bungalow/rent/state/texas/street/exloër/exloër with this rewrite rule: <rule name="rentals by proptype+state+city+street"> <match url="^([a-zA-Z0-9-+]+)/rent/state/([a-zA-Z-+]+)/street/([a-zA-Zë-+]+)/([0-9a-zA-Zë-+']+)$" /> <action type="Rewrite" url="search_new.aspx?proptype={R:1}&state={R:2}&city={R:3}&street={R:4}" /> </rule> results in a 500 error This URL http://www.example

Must one use an MVC FrameW to produce clean URL's?

大兔子大兔子 提交于 2019-12-14 03:44:29
问题 The host that I want to host with does not support server side url rewriting, thus no third party tools can be installed to rewrite the url's. This is Coldfusion 8, on windows, IIS. The other alternative that I know of is to use a framework, but I do not feel like taking that route (time), for the application works well as it is (but the URL). Can clean urls be generated by purely CF? I do not need the clean url's for seo, rather it will be for the user's easy reference to their page. E.g.

Fixing relative links in PHP

让人想犯罪 __ 提交于 2019-12-14 03:32:39
问题 I'm parsing an external document and making all of the links in it absolute. For instance: <link rel="stylesheet" type="text/css" href="/css/style.css" /> would be replaced with: <link rel="stylesheet" type="text/css" href="http://www.hostsite.com/css/style.css" /> where http://www.hostsite.com is the base URL for the document. This is what I've tried and failed at: $linkfix1 = str_replace('href=\"\/', 'href=\"$url\/', $code); There are several questions on the site related to doing this

.htaccess redirect /amp/ urls to nonamp version

僤鯓⒐⒋嵵緔 提交于 2019-12-14 03:28:53
问题 I need to recover AMP Urls after switching off Google AMP. Can you help me please for having 301 redirects on any AMP url back to NonAMP Version? Example: anydomain/hardware/heute-ist-putztag/amp back to anydomain/hardware/heute-ist-putztag 回答1: found a solution at myself RewriteRule ^(.*)\/amp$ $1 [R=301,L] 来源: https://stackoverflow.com/questions/44854689/htaccess-redirect-amp-urls-to-nonamp-version

mod_rewrite rule to remove “.php” extension and rewrite query string

大城市里の小女人 提交于 2019-12-14 03:26:42
问题 Hello i an new to Mod_Rewrite and want to use it for the first time, I have one simple request, How do i remove the .php extension from my page and rewrite querystring. http://localhost/myproject/aboutus.php?page=info http://localhost/myproject/products.php?page=first-product i have multiple pages like this and what i need to do is http://localhost/myproject/aboutus/info http://localhost/myproject/products/first-product Likewise aboutus.php?page=moreinfo and product.php?page=second-product

IIS8 RewriteModule / URLRewrite Extremely Slow

萝らか妹 提交于 2019-12-14 03:23:56
问题 I'm running a website with IIS8 on Windows Server 2012. I'm trying to determine what's causing high CPU usage by IIS (frequently 50% or more CPU usage by IIS). Server receives about 40 total requests per second throughout the day, but probably only 1-2 URLs per second that require processing. I enabled Request Tracing and found that some RewriteModule requests are taking over 100 seconds (!) to complete. I'm having trouble determining how this is possible on a machine with more than

htaccess url rewrite multiple url

筅森魡賤 提交于 2019-12-14 03:13:50
问题 I've a problem to rewrite url in my site with .htaccess index.php $op = $_GET['op']; switch ($op) { case "src": include("src.php"); break; case "dts": include ("dts.php"); break; default: include("home.php"); break; } Link to rewrite index.php?op=src index.php?op=dts&idric=20&sp=2 .htaccess Options +FollowSymLinks RewriteEngine on RewriteRule \.(css|jpe?g|gif|png|js|ico)$ - [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/$ index.php?op=$1 [L,QSA]