.htaccess

Mod_rewrite .htm to fake subdirectory

二次信任 提交于 2020-01-06 06:36:37
问题 I have a website with a CMS that uses mod_rewrite to make URLs look cleaner. Previously, the clean URLs had the extension .htm, but I want to transition this to them appearing as fake subdirectories, IE: http://www.example.com/pagename/ I have two rewrite rules in place to rewrite both the old scheme and the potential new one: RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+).htm$ index.php?page=$1 [QSA] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ index.php?page=$1 [QSA] My

301 redirect .htaccess

一世执手 提交于 2020-01-06 06:32:15
问题 Im trying to request the following entire site 301 redirect: word.something.blah.domain.com --> http://www.word.com I don't know how to write the 301 redirect rule. Can someone help out? 回答1: I will assume you are using the same directory to serve files on both domains. In which case, a Redirect clause won't work (infinite redirect loop). With mod_rewrite , you can check the value of the current HTTP_HOST and take a decision based on that: RewriteEngine On RewriteCond %{HTTP_HOST} ^([a-zA-Z0

ERR_TOO_MANY_REDIRECTS when redirecting to non-www HTTPS in Laravel

邮差的信 提交于 2020-01-06 06:01:12
问题 I am trying to redirect all calls to non-www HTTPS on my website and have the following code in my .htaccess file in Laravel besides the auto generated stuff: RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [L,R=301,NC] and the following routes: Route::get('/', function () { return redirect()->route('build.index'); }); Auth::routes(); // Profile Route::get('/profile/{user}', 'ProfilesController@show')->name('profile

Advice on Configuring .HTaccess file to Redirect HTTP Subdomain to HTTPS Equivalent

我的梦境 提交于 2020-01-06 05:59:50
问题 I'm sure there is an easy answer to this question, but I've scoured through through available threads and its either not there or I'm too ignorant to recognize it starting in my face. This seems to be the answer, but I just can't configure correctly. Question : How do I set up .htaccess so that all subdomains are forwarded to their https equivalents, while also allowing the main domain itself get ported to its https equivalent? In other words: hxxp://subdomain1.domain.com --> hxxps:/

Rewrite url with 2 or more params

微笑、不失礼 提交于 2020-01-06 05:49:13
问题 I asked a question like this before but since i still can't find an answer to this i'll ask it again :-s. I'm using this very basic 'templating' script: require_once 'core/init.php'; if(empty($_GET['page'])){ header('Location: home'); die(); } $basePath = dirname(__FILE__) . '/'; $viewPath = $basePath . 'view/'; $view = scandir($viewPath); foreach($view as $file) { if (!is_dir($viewPath . $file)) { $pages[] = substr($file, 0, strpos($file, '.')); } } if(in_array($_GET['page'], $pages)){

Redirection through htaccess not working

寵の児 提交于 2020-01-06 05:49:04
问题 I want to rewrite the URL like below: URL: http://localhost/my_site/?file_name=sample This is my URL I want to show it like: URL: http://localhost/my_site/sample that means I want to remove file_name parameter and get the parameter value and set it in URL, for setting this I have used below code: RewriteEngine On RewriteBase /my_site/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ /?file_name=$1 [QSA,L] But its

.htaccess: Redirect some subpages to new subpage, all others to new main page

一曲冷凌霜 提交于 2020-01-06 05:45:07
问题 I have searched SO for answers but have not found any matching my criteria. I am moving a webshop to a new domain (it has 1000s of products). For the pages with some decent rankings, I want to redirect them to their new respective subpages. All other pages I want to redirect to the new main page. I am trying to accomplish this using .htaccess shopold.com/cat/product1.html to shopnew.com/category/product1 shopold.com/cat/product2.html to shopnew.com/category/product2 All other pages from

Change appearance of URLs with htaccess mod_rewrite RewriteRule

一个人想着一个人 提交于 2020-01-06 05:35:28
问题 It's really tough to find clear explanations of the Rewrite Engine syntax anywhere. Regular expressions are familiar, but the rest of it is alien to me. Is there no way to hide http:// or https:// in the URL that is displayed in the address bar? My directory looks like this. public_html/ example/ index.php whatever.php Issue #1 This is currently what's happening, which obviously all over the place. URL THAT IS TYPED IN URL THAT DISPLAYS https://www.example.com -------------------> https://www

how to replace ?= and & from url with / by htaccess in PHP CI

安稳与你 提交于 2020-01-06 05:33:09
问题 Hello all i am new with htaccess and i dont know how to make my url SEO friendly, please do guide me little here here is my url domain.com/article?seo=What-Software&id=7 required url domain.com/article/What-Software/7 can also accept as domain.com/article/What-Software/id/7 here is my current htaccess RewriteEngine On # remove /index.php/main/ from URLs RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{THE_REQUEST} \s/+index\.php/main/ [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]

.htaccess editing to hide folder from url & accessing main domain

早过忘川 提交于 2020-01-06 05:22:13
问题 i used a .htaccess editing to hide folder/directory from my website url. skynetbd.net/user_profile/login.php to skynetbd.net/login.php I used this: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+user_profile/([^\s]+) [NC] RewriteRule ^ %1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (?!^user_profile/)