mod-rewrite

Trailing dots being stripped from URL

巧了我就是萌 提交于 2020-01-15 12:37:13
问题 I've got a url - http://callisto/news/1st_February_is_here... - which has three trailing dots, but by the time it gets passed through mod_rewrite and reaches the script (in $_GET) the dots have been removed (but the rest of the string is OK). This is the htaccess rule: RewriteRule ^([^/]+)/(.*)$ index.php?__action=site&__filter=$1&__page=$2 [L,QSA] Thanks. 回答1: I take it you are using the title of a post or something similar as the third position in your URI. Due to the fact that you could

htaccess rewrite slug in a url

天涯浪子 提交于 2020-01-15 12:33:46
问题 I've searched and searched for help on a rewrite rule but nothing seems to match specifically what I'm trying to do, hopefully someone can help? I'm trying to replace a slug in a url that could have various other possible slugs before and after it. e.g. http://www.example.com/slug/old_slug to http://www.example.com/slug/new_slug or /slug/old_slug/slug to /slug/new_slug/slug or /slug/old_slug/slug/slug to /slug/new_slug/slug/slug or finally: /slug/old_slug/slug?param=1&param=2 to /slug/new

Rewrite single and consecutive underscores to dashes

这一生的挚爱 提交于 2020-01-15 12:33:31
问题 I'm trying to rewrite URLs with underscores in to dashes for a shopping site. Product names currently have underscores for spaces. A typical URL is as follows: http://test.local/category-name/product_name_a My current .htaccess is as follows and successfully rewrites this to: http://test.local/category-name/product-name-a RewriteEngine On RewriteBase / #Rewrite Underscores to dashes RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^_]*)_([^_]*)$ $1-$2 [L,R=302,NE] RewriteCond %{REQUEST

htaccess rewrite slug in a url

淺唱寂寞╮ 提交于 2020-01-15 12:33:19
问题 I've searched and searched for help on a rewrite rule but nothing seems to match specifically what I'm trying to do, hopefully someone can help? I'm trying to replace a slug in a url that could have various other possible slugs before and after it. e.g. http://www.example.com/slug/old_slug to http://www.example.com/slug/new_slug or /slug/old_slug/slug to /slug/new_slug/slug or /slug/old_slug/slug/slug to /slug/new_slug/slug/slug or finally: /slug/old_slug/slug?param=1&param=2 to /slug/new

mod_rewrite is preventing my form to be submitted as desired

笑着哭i 提交于 2020-01-15 12:27:28
问题 I have created a www.example.com and m.example.com. The m.example.com resides inside the htdocs/m/ folder. I am also deleting the '.php' extensions using .htaccess. I am having the below codes on the root directory: RewriteCond %{REQUEST_METHOD} =POST RewriteRule ^ - [L] # Redirect external .php requests to extensionless url RewriteCond %{THE_REQUEST} \s/+(.*?/)?(?:index)?(.*?)\.php[\s?] [NC] RewriteRule ^ /%1%2 [R=302,L,NE] #mobile RewriteCond %{HTTP_HOST} ^m\.example\.com$ [NC] RewriteCond

I can't seem to get started with Zend Framework 2 skeleton app

▼魔方 西西 提交于 2020-01-15 12:11:54
问题 I'm following through the getting started skeleton app tutorial on the Zend homepage: http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html I've got as far as being able to enter into the browser address bar "zf2-tutorial.localhost/" and my Zend welcome page should appear. It doesn't, the apache web folder (/var/www) directory appears instead. If I enter "http://zf2-tutorial.localhost/1234" to test whether the Zend 404 page appears, it doesn't. The default apache Not

mod_rewrite appends query string when not using trailing slash

故事扮演 提交于 2020-01-15 12:07:26
问题 I've spent some time on Google and SO trying to figure this out and I have now had to resort to asking yet another mod_rewrite question.... I am using mod_rewrite and for the most part it works fine. The part I am having problems with is: # Load pages for health-it while keeping the URL masked RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^health-it/([-a-z0-9]+)/? /health-it/loadPage.php?p=$1 [NC,L] I have a URI that I want: /health-it/aimsconsultant The problem is, mod_rewrite is doing

mod_rewrite appends query string when not using trailing slash

淺唱寂寞╮ 提交于 2020-01-15 12:05:14
问题 I've spent some time on Google and SO trying to figure this out and I have now had to resort to asking yet another mod_rewrite question.... I am using mod_rewrite and for the most part it works fine. The part I am having problems with is: # Load pages for health-it while keeping the URL masked RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^health-it/([-a-z0-9]+)/? /health-it/loadPage.php?p=$1 [NC,L] I have a URI that I want: /health-it/aimsconsultant The problem is, mod_rewrite is doing

How to add subdomain in .htaccess and force WWW in url

Deadly 提交于 2020-01-15 11:51:14
问题 I have the following code to force WWW in url rewriteCond %{HTTP_HOST} !^www.example.com [NC] rewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] I want to add a subdomain max.example and refer to www.example.com/update/max directory If I do not add any rule, max.example.com will redirect to www.example.com/update/max . If I remove force WWW in url it works. But I still need force WWW in url. How to write the rule? Thanks! 回答1: Change your rule to this: RewriteCond %{HTTP_HOST} !^(www|max)

language parameter rewrite with mod_rewrite

元气小坏坏 提交于 2020-01-15 11:37:42
问题 I need some help with mod_rewrite doing multiple things to the url procedurally: If the url starts with en,es,pt-br, remove it and add ?lang=$1 If the url does not next have 'web/' in it, add it. If the url is blank, go to 'web/en/' None of them should actually rewrite the url This means: http://www.domain.com/en >> http://www.domain.com/web/?lang=en http://www.domain.com/en/mobile >> http://www.domain.com/mobile/?lang=en 回答1: Try: RewriteEngine On # This is to prevent the rules from looping,