Can anyone help me to rewrite my URL like this using .htaccess :
http://website.com/name-of-category/title-of-the-article
need to be rewritten to
http://website.com/name-of-category#title-of-the-article
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Something like this ?
RewriteRule ^([^/]+)/(+.)/$ /#$1 [L,R,NE]
Thank you in advance !
You can use this rule in root .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/(.+)/$ /$1#$2 [L,R=302,NE]
Related
I try to redirect url from
http://localhost/manual/$
to
http://localhost/manual/index.php?type=post&post=$
My file .htaccess is
RewriteEngine On
RewriteBase /manual/
RewriteCond %{REQUEST_FILENAME} !-f # Existing File
RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory
RewriteRule . /manual/index.php? [L]
RewriteRule ^([^/]*)\/$ type=post&post=$1 [L]
But nor working whats wrong, help, sorry if duplicate because I still not understand to create htaccess.
You can use the following rule in /manual/.htaccess :
RewriteEngine on
RewriteBase /manual/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?type=post&post=$1 [L]
I want to change my url from:
www.domain.com/includes/edit.php?products=cloth
to:
www.domain.com/products/cloth
I'm using this code right now but it's not working:
RewriteEngine On
RewriteRule ^products/([A-Za-z0-9-]+)/?$ edit.php?q=$1 [NC,L]
Try this :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^products/([A-Za-z0-9-]+)/?$ /includes/edit.php?products=$1 [QSA,NC,L]
I would like to redirect link http://example.com/asdasdas/edit to http://example.com/asdasdas/index.php/edit using htaccess. I did this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} edit
RewriteRule ^ %{REQUEST_URI}/index.php [L,R=301]
but it's a loop and doesn't works well. Any ideas?
You can use this rule in /asdasdas/.htaccess:
RewriteEngine On
RewriteBase /asdasdas/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) index.php/$ [L]
This will support URL of http://example.com/asdasdas/edit
I would like to redirect all paths like this:
myurl.com/worldwide/en
myurl.com/worldwide/pt
myurl.com/worldwide/de
to:
myurl.com/worldwide/index.php?lang=en
myurl.com/worldwide/index.php?lang=pt
myurl.com/worldwide/index.php?lang=de
Just to be clear a dynamic redirection of the pathname after /worldwide
Actually ideally I would like to keep the original url (e.g. myurl.com/worldwide/de) but load the same php file with the language directory as a param but not sure if this is possible?
Thanks
Use this code
RewriteEngine On
RewriteBase /worldwide/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?lang=$1 [L,QSA]
Please let me know if this helps you
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteRule ^(.+)$ /index.php?page=$1 [L,QSA]
I have a problem with .htaccess not forwarding the GET/POST parameters..
Here's my .htaccess :
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteRule .* index.php?a=%1&b=%2 [L]
But when I do something like :
mywebsite.com/url1/url2?action=delete&id=2
It redirects me to :
mywebsite.com/index.php?a=url1&b=url2
so it deletes the action=delete&id=2 and I have nothing in $_GET, is there any way to do that?
Thanks in advance.
Use QSA (as in Query String Append)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteRule .* index.php?a=%1&b=%2 [L,QSA]