.htaccess

How to execute php files with .html extension?

家住魔仙堡 提交于 2020-01-23 13:05:37
问题 i have problem with my site, when i try to convert php to html, i got this error Not Found and this is .htaccess RewriteEngine on RewriteRule ^(.*)\.php$ /ver1/$1.html [R=301,QSA,L] all files in folder ver1 i see this post .php url to .html url but not work with me i just need convert php to html and if i go to index.php i go to index.html and make all url html 回答1: Rename your .php file to .html and add this line in your .htaccess AddType application/x-httpd-php .html .htm 回答2: You need to

How to make a tumblr style profile url

大兔子大兔子 提交于 2020-01-23 07:20:49
问题 I wonder, how does tumblr doing profile url like this: http://www.username.tumblr.com/ http://username.tumblr.com/ I know we can change the profile url http://www.website.com/profile.php?user=username to http://www.website.com/username using the following RewriteRule RewriteRule ^([^/]+)/?$ profile.php?user=$1 [L,QSA,NC] I don't know how tumblr doing those profile urls. How can we make user profile urls like this: http://www.username.website.com/ http://username.website.com/ I have a

301 redirect in StackOverflow. How does it works? [closed]

痞子三分冷 提交于 2020-01-23 03:15:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Let's take, for instance, the url of this question http://stackoverflow.com/questions/20306229/301-redirect-in-stackoverflow-how-does-it-works If i change something in the final part of the URL, making it like http://stackoverflow.com/questions/20306229/301-r I get a 301 message and i'm redirected EXACTLY to the

Use domain as “prefix” on CakePHP

不羁岁月 提交于 2020-01-23 02:46:06
问题 Let's say that I have a site running CakePHP and I have the prefix "product". I have lots of pages with URL like: http://mysite.com/produt/blue-shirt/details http://mysite.com/produt/blue-shirt/order http://mysite.com/produt/skate/details http://mysite.com/produt/sun-glasses/vendors Now I need to use a domain like http://mysite-blue-shirt.com/ as "shortcut" to the blue-shirt product, and my URLs will become: http://mysite-blue-shirt.com/details http://mysite-blue-shirt.com/order What I need

Cannot remove 301 redirect

偶尔善良 提交于 2020-01-22 17:25:31
问题 I stupidly did a 301 redirect on websiteA.com to websiteB.com. After removing it from the .htaccess file the redirect is still in operation. I tried from outside the local network and it is still redirecting. I have cleared my cache and tried a different browser. Does anybody have any suggestions? UPDATE: If I add a 302 redirect to this .htaccess file the site honours it. When I remove it, the old 301 redirect still happens. .htaccess file for websiteA.com: # -- concrete5 urls start --

Apache .htaccess to redirect index.html to root, why FollowSymlinks and RewriteBase?

 ̄綄美尐妖づ 提交于 2020-01-22 15:19:05
问题 In order to redirect all somefolder/index.html (and also somefolder/index.htm ) to somefolder/ I use this simple rewrite rule in Apache .htaccess file: RewriteEngine on RewriteCond %{THE_REQUEST} ^.*\/index\.html?\ HTTP/ RewriteRule ^(.*)index\.html?$ "/$1" [R=301,L] This works well! But at Google groups they suggest to add also: Options +FollowSymlinks RewriteBase / Could anyone be so kind to explain me why would i have to add these last lines, and explain me a bit what they mean and what

problems using mod_headers with php-fpm/mod_fastcgi

落花浮王杯 提交于 2020-01-22 14:14:45
问题 I'm trying to add HSTS headers to every response, across my app. My first thought was to use mod_headers — I placed this directive in an .htaccess file at the documentroot: Header set Strict-Transport-Security "max-age=7776000" This works fine on my local setup using Apache 2.2 and mod_php. All resources respond with the appropriate HSTS header. My deployment environment uses Apache 2.2 and mod_fastcgi and the above technique works for any resource except php files. Another SO question had a

Ridirecting to a site when there is a ?(question mark) in the URL?

那年仲夏 提交于 2020-01-22 03:34:08
问题 I need an htaccess which redirects if there is a ?(question mark) in the URL, Some sample URL's, mysite.com/?p=44 mysite.com/?m=44 mysite.com/?cat=44 mysite.com/index.php?cat=44 The question mark could be anywhere after the "/". It should work for with the "www" and without it as well. If there is a question mark, it should go to newsite.com. Since I'm new to htaccess I don't know how to go about it and new some help from you'll. Thanks. 回答1: You can try this rule RewriteEngine On RewriteCond

Rewrite URL in PHP with mod_rewrite

社会主义新天地 提交于 2020-01-22 03:33:05
问题 The web server is Apache. I want to rewrite URL so a user won't know the actual directory. For example: The original URL: http://www.example.com/en/piecework/piecework.php?piecework_id=11 Expected URL: http://piecework.example.com/en/11 How to achieve it with mod_rewrite? 回答1: You need to define a rewrite rule (should be similar to this): RewriteRule ^/(.*)/en/piecework/(.*)piecework_id=([0-9]+)(.*) piecework.mydomainname.com/en/$3 and put it in a .htaccess file under the main folder of you

htaccess redirect folder to subfolder

与世无争的帅哥 提交于 2020-01-22 03:13:27
问题 Notice: I wrote the solution. Thank you anyway. :) I know it seems duplicated question: I searched a lot, I applied tens of rewrite rules but they don't work. I need to redirect from www.domain.com/folder1 to www.domain.com/folder1/subfolderA Note: folder1 is emtpy. in subfolderA I have index.html, index.php, css file, js files. If I go to "www.doman.com/folder1/subfolderA/" I see a simple web page with correct css and js provided by index.php file. My .htaccess file is in www.domain.com/ (I