clean-urls

rewriting url with query string

。_饼干妹妹 提交于 2020-02-07 12:30:13
问题 in continuation to what i asked here i want to auto rewriting of below url http://testsite.com/siterootb/sample-page.php?bbi=value1&bbl=value2 to http://testsite.com/siterootb/sample-page/value1/value2 my htaccess now looks like RewriteEngine on RewriteCond %{QUERY_STRING} !^$ RewriteRule ^(.*) http://localhost%{REQUEST_URI}%1? [R=301,L] ########################################################################### RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/siterootb/([^/]+

Yii2 Clean URLs & Action Parameters

血红的双手。 提交于 2020-01-13 13:10:00
问题 I've enabled clean URLs on my Yii2 application, but I can't seem to get arguments to pass to the action. I expect this: localhost/app/web/a/b/c/d To map to the following: AController->actionB($c, $d) It's not happening. Here's my .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php The relevant part of my web.php: 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false,

htaccess rewrite index.php on root and subfolders

家住魔仙堡 提交于 2020-01-13 06:49:07
问题 I'm trying to redirect all requests to ./index.php?site=$1 while I only want to use the part behind the last slash. So I want www.mydomain.com/firstpage to become www.mydomain.com/index.php?site=firstpage and www.mydomain.com/subfolder/anotherpage to become www.mydomain.com/subfolder/index.php?site=anotherpage But right now www.mydomain.com/subfolder/anotherpage becomes www.mydomain.com/index.php?site=subfolder/anotherpage This is what I've got: RewriteEngine on Options +SymlinksIfOwnerMatch

Apache .htaccess mod_rewrite and clean urls

主宰稳场 提交于 2020-01-06 20:17:19
问题 Ok. So I'm building this site which is accessible through two different domains. So I can't use RewriteBase in my .htaccess. The rules (below) I use to work around this problem seem to work fine. However, when I use the below .htaccess settings on my local box with clean URLS (WAMP) it all works fine but the moment I use this on the live server (shared hosting LAMP) every page I navigate to displays the home page (the one under index I guess) even though the URL in the browser is clearly

.htaccess redirect variable to friendly link - many redirects

廉价感情. 提交于 2020-01-06 05:21:06
问题 I have a problem with htaccess redirecting a variable to clean url. the code: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php?page=$1 [R] RewriteCond %{QUERY_STRING} ^page=about$ RewriteRule ^(.*)$ https://www.url.com/about? [R=301,L] i just want to redirect this: "?page=about" to this: "/about" and with the code above give me to many redirects... Thanks for the time to look at this. 回答1: So i have tried your code in an empty directory on

Removing .php from urls with lighttpd (clean urls)

一曲冷凌霜 提交于 2020-01-03 05:44:04
问题 I am migrating an over loaded server from apache2 to lighttpd, currently I am proxying all the static resources from the lighttpd server but that still doesn't fix the load problems. I want to migrate everything to lighttpd but I've run into a problem. Apache2 has multiviews functionality to clean up URLs which lighttpd doesn't. I found the following code to do it in lighttpd url.rewrite-if-not-file = ( "^([^?]*)(\?.*)?$" => "$1.php$2" ) It works but it has two problems 1: website.com/

What is the best way to remove punctuation marks, symbols, diacritics, special characters?

雨燕双飞 提交于 2019-12-30 07:59:09
问题 I use these lines of code to remove all punctuation marks, symbols, etc as you can see them in the array, $pattern_page = array("+",",",".","-","'","\"","&","!","?",":",";","#","~","=","/","$","£","^","(",")","_","<",">"); $pg_url = str_replace($pattern_page, ' ', strtolower($pg_url)); but I want to make it simpler as it looks silly to list all the stuff I want to remove in the array as there might be some other special characters I want to remove. I thought of using the regular expression

get params with clean url in multi hosting environment

五迷三道 提交于 2019-12-24 10:03:05
问题 the website root contains three directories say a,b,c all acting as root for different domains i created one .htaccess in directory b and added the following rules to it RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ^([^/]*)/?([^/]*)/$ /b/sample-page?bbi=$1&bbl=$2 [L] In place of last line above, i have also tried RewriteRule ^b/([^/]*)/([^/]*)$ /b/sample-page?bbi=$1&bbl=$2 [QSA,L] Using above rules http:/

How to write seo friendly url's using htaccess?

浪子不回头ぞ 提交于 2019-12-23 03:52:17
问题 I want to create seo friendly url's for my website. I want to create it from .htaccess file. I have very less knowledge about .htaccess I have following url http://www.testsite.com/index.php?dispatch=flowers_search.flowers_search_result&city=Pune&type=Carnation I need to display url as follows, http://www.testsite.com/flowers/Pune/Carnation Thanks 回答1: http://www.generateit.net/mod-rewrite/ resulting in: RewriteEngine On RewriteRule ^([^/]*)/([^/]*)$ /index.php?dispatch=flowers_search.flowers

Passing multiple parameters in a hyperlink in yii2 with clean urls, Html::a() doesnt generate clean url

ぐ巨炮叔叔 提交于 2019-12-22 03:48:16
问题 I am trying to generate a hyper link by the method mentioned in http://www.yiiframework.com/doc-2.0/guide-helper-html.html#hyperlinks like this Html::a('<b>Register</b>', ['story/create', array('id' =>39,'usr'=>'11')], ['class' => 'profile-link']) I want to get url like story/create/id/39/usr/11 But it is generating as story/create?1%5Bid%5D=39&1%5Busr%5D=1 I have enabled the clean url functionality of yii2 like 'urlManager' => [ 'class' => 'yii\web\UrlManager', // Disable index.php