mod-rewrite

How do I stop mod_rewrite from appending links to url?

。_饼干妹妹 提交于 2019-12-18 07:24:06
问题 I expect the answer is going to be something so simple I'll want to cry, but I can't seem to figure it out. I'm new to mod_rewrite. I wanted to change my links from things like domain.com/?p=about to domain.com/about* / * (with the trailing slash) and it works fine, but whenever I move on to a link, it appends the new link to the back of the url. For example, I have an about and a contact link. If I click about it navigates to domain.com/about/ then if I click contact, it navigates to domain

htaccess 301 redirect for URL with parameter

孤人 提交于 2019-12-18 07:22:46
问题 I have the following in my htaccess file, which takes a URL like: www.example.com/Page.php?id=About and turns it into www.example.com/about. The only issue is that the old URLs are not redirecting to the new URLs when I set up Redirect 301s in the htaccess (which I understand is because you're not supposed to pass parameters in basic Redirect 301s - example of basic Redirect that I've tried below). Redirect 301 /Page.php?id=About http://www.example.com/about The catch is that the new URLs don

How to rewriterule URL using .htaccess

a 夏天 提交于 2019-12-18 07:15:13
问题 how to rewriterule for link like this http://stanime.pe.hu/content.php?idf=15&link=Katsugeki--Touken+Ranbu to http://stanime.pe.hu/15/Katsugeki--Touken+Ranbu im encode and decode my url using Urlencode and urldecode in database Collation im using latin1_swedish_ci so, space will replace with + and / replace with %2f and more... this my .htacces code RewriteEngine On # external redirect from actual URL to pretty one RewriteCond %{THE_REQUEST} \s/+content\.php\?link=([^\s&]+) [NC] RewriteRule ^

How to rewriterule URL using .htaccess

拟墨画扇 提交于 2019-12-18 07:15:00
问题 how to rewriterule for link like this http://stanime.pe.hu/content.php?idf=15&link=Katsugeki--Touken+Ranbu to http://stanime.pe.hu/15/Katsugeki--Touken+Ranbu im encode and decode my url using Urlencode and urldecode in database Collation im using latin1_swedish_ci so, space will replace with + and / replace with %2f and more... this my .htacces code RewriteEngine On # external redirect from actual URL to pretty one RewriteCond %{THE_REQUEST} \s/+content\.php\?link=([^\s&]+) [NC] RewriteRule ^

mod_rewrite for all pages (including subfolders) on a site to a single php page

≯℡__Kan透↙ 提交于 2019-12-18 07:06:39
问题 I am in the process of converting my site with many static html pages to a site driven by a database. My problem is that I don't want to lose what google has already indexed, so I would like to rewrite requests to be sent through a php script which lookup the filepath for content in the database. My understanding is that a mod_rewrite would best serve this purpose, unfortunately I have never used it, so I am a bit lost. What I have: www.domain.com/index.html www.domain.com/page.html?var=123

Simple .htaccess rewrite to pass 1 parameter

亡梦爱人 提交于 2019-12-18 06:50:57
问题 Can someone please tell me what should my .htaccess file contain to create the following rewrite: http://www.example.com/success to call http://www.example.com/index.php?q=success 回答1: Try with: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ /index.php?q=$1 [L] 回答2: Heres is one way to do it: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^.*(success)/?$ RewriteRule .* http://www.mysite.com/index.php?q=%1 [L

URL rewrite with .htaccess make duplicate mysql entries

℡╲_俬逩灬. 提交于 2019-12-18 06:16:27
问题 If rewrite url with .htaccess, all INSERT query with php is performed twice (unwanted duplication) My .htaccess : <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> And index.php : <?php define('DB_LOGIN', 'mylogin'); define('DB_PASS', 'mypass'); define('DB_HOST', 'localhost'); define('DB_TYPE', 'mysql'); define('DB_NAME', 'dbname'); $mysql =

mod_rewrite number of parameters/back-references limitation

人走茶凉 提交于 2019-12-18 06:13:54
问题 Apparently there is a limitation (9) on how many backreferences you can access in htaccess RewriteRules.. But we have a RewriteRule that requires more than 9 parameters, something like this: RewriteRule ^([^/]+)/b([0-9]+)(/a([0-9]+))?(/v([0-9]+))?(,([0-9]+))?(/(ajax|share))?(,complete)?$ /index.php?control=sites&site=brands&control_file=version_select&name=$1&campaign_id=$2&answer=$4&page=$8&option=$10&video_id=$6&page_type=research [L] So what happens when you try to access "$10", is that it

remove multiple trailing slashes mod_rewrite

谁说我不能喝 提交于 2019-12-18 06:12:48
问题 I know this question was asked a number of times on this site alone, but browsing through the relevant posts I couldn't find a solution. Trying to remove multiple trailing slashes after domain. The following mod_rewrite expressions seem to work for URLs such as http://www.domain.com//path1///path2////, but do not work for domain// DirectorySlash Off RewriteEngine on # Canonical fix RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] RewriteRule

Removing .php file extension with .htaccess file

自闭症网瘾萝莉.ら 提交于 2019-12-18 05:54:51
问题 I want www.example.com/about.php to just be www.example.com/about I created an .htaccess file and placed it in the root of my server. I am using linux shared hosting. PHP version 5.2 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php It seems that this code should work properly, but for some reason it does not. I get a 404 error when I try to navigate to a page without the .php extension. Here's my markup too: <nav> <div