url-rewriting

How to remove action name from url in cakephp?

坚强是说给别人听的谎言 提交于 2019-12-17 22:01:29
问题 I am working on cakephp project. I have removed index.php from URL using .htaccess file and now I want to remove view name from URL & add some other two varying parameter. Suppose I choose country & city then these two parameter should appear in URL on selecting them. The problem I am facing is as cakephp takes www.example.com/Controllername/viewname But my requirement is like this www.example.com/Controllername/param1/param2 If I pass this way It looks for param1 as controller and param2 as

mod_rewrite URL info required

余生长醉 提交于 2019-12-17 21:33:09
问题 I am new to this mod_rewrite. I have been successfully able to rewrite the URL something like this: http://mydomain.com/products/12 to this: http://mydomain.com/products.php?prodId=12 But when I give http://mydomain.com/products/12 in the address bar, the css and js files are not loaded. But when I access http://mydomain.com/products.php?prodId=12 the js and css get loaded properly. Please let me know if I am missing something. My .htaccess looks like this: Options +FollowSymlinks

How to rewrite specific urls using mod_rewrite?

社会主义新天地 提交于 2019-12-17 20:43:29
问题 I have a geoip http header named {HTTP:CF-IPCountry} that store the country code like FR, US etc.. what i need to do is to add this query string loc={HTTP:CF-IPCountry} to the website homepage https://example.com/test-website/ and to any page that has url start with https://example.com/test-website/products/ or https://example.com/test-website/shop/ and append the query string if there are any other query strings used on the url so if the user requested page https://example.com/test-website

Rewriting URL with .htaccess local in XAMPP

别来无恙 提交于 2019-12-17 20:36:33
问题 My .htacces begins with RewriteEngine on RewriteBase / (I tried it also without RewriteBase...) I tried all of the following rewriting rules to rewrite the URL index.php?page=news to /blog RewriteRule ^/?([-A-Za-z0-9]+)/([-A-Za-z0-9]+)/blog$ index.php?page=$1 [L] RewriteRule ^([^/]*)/blog$ /sites/blog/index.php?page=$1 [L] RewriteRule ([a-zA-z]+)/([a-zA-z]+)/blog$ index.php?page=$1 [L] Nothing works - no error. Mod_rewrite is installed and working. I restarted Apache and MySQL everytime I

.htaccess for friendly URL with multiple variables

人盡茶涼 提交于 2019-12-17 19:53:36
问题 I am working on making my site more SEO friendly I am currently using RewriteEngine On RewriteRule (.*)$ index.php?page=$1 To turn site.co.uk/index.php?page=page_name into site.co.uk/page_name I want to also use this for sub pages too. I have tried this: RewriteEngine On RewriteRule (.*)/(.*)$ index.php?page=$1&subpage=$2 but its not working, it runs site.co.uk/page_name/sub_page but when you go to site.co.uk/page_name it returns the 404 not found. I want it to run site.co.uk/page_name and it

Mode Rewrite; with/without trailing slash on end of url?

谁都会走 提交于 2019-12-17 18:24:33
问题 I basically tried this mode_rewrite rule below. It works with a slash on the end but I want it to work whether it has a trailing slash on the end or not. Basically I want it like this as some people see it as normal with a slash on the end and others don't hence why I want it to work whether it's there or not. RewriteRule ^signup/register(.[^/]*) /signup/register.php [NC] Basically it will work like http://localhost/signup/register/ but if I remove the / from the end it gives 404 error. 回答1:

RewriteRule causes page to reload twice

六月ゝ 毕业季﹏ 提交于 2019-12-17 16:57:14
问题 I shaped two different RewriteRules for my page: # Enable URL Rewriting RewriteEngine on # exclude followed stuff RewriteRule ^(js|img|css|favicon\.ico|image\.php|anprobe|content|libs|flash\.php|securimage)/ - [L,QSA,S=2] # conditions (REQUEST dont point @ file|dir|link) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-F RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l # rules RewriteRule ^(?!index\.php)brillen/(.*(brillen)|360|neu)/(.*)([a-zA-Z0-9]

URL rewriting for different protocols in .htaccess

早过忘川 提交于 2019-12-17 11:54:43
问题 I need help with url-rewriting in .htaccess. So the issue is about different protocols: https and http. The main purpose of rewriting is to remove "www" from URL, but protocol should stay the same it was before. For example, when I have URL like http ://www.domain.com/request, it should be redirected to the http ://domain.com/request. I resolve it with these rules: RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] But in case, when URL looks

Proper method to remove www from address using IIS URL Rewrite

我怕爱的太早我们不能终老 提交于 2019-12-17 11:01:04
问题 What is the optimal way to remove the www subdomain from a url using IIS URL Rewrite? 回答1: If you want it to work with any hostname (not hardcoding it into the rule), you'd want to do something like this: <rule name="Remove www" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^www\.(.+)$" /> </conditions> <action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />

Simulate file structure with PHP

試著忘記壹切 提交于 2019-12-17 10:57:14
问题 I'm running PHP on a shared Apache web server. I can edit the .htaccess file. I'm trying to simulate a file file structure that is not actually there. For example, I would like for the URL: www.Stackoverflow.com/jimwiggly to actually display www.StackOverflow.com/index.php?name=jimwiggly I got halfway there by editing my .htaccess file as per the instructions in this post: PHP: Serve pages without .php files in file structure: RewriteEngine on RewriteRule ^jimwiggly$ index.php?name=jimwiggly