htaccess rewrite url to css on WordPress site - php

I want to rewrite url to css-files(looks like http://localhost/wordpress/my-page/assets/css/style.min.css) to new path (http://localhost/wordpress/my-page/my-project/app/assets/css/style.min.css). How can i do this?

Please use following code in .htacess file.
RewriteRule ^/wordpress/my-page/assets/css/style.min\\.css$ http://localhost/wordpress/my-page/my-project/app/assets/css/style.min.css [L]

Related

Rewrite rule for url in php in .htaccess file

I want to use rewrite rule for may website.
I have a link
www.mysite.com/product.php?p_id=1212
Need to convert like
www.mysite.com/product/1212
Please suggest me the rewrite rule for .htaccess file.
Thanks in advance.
please add this rule in your .htaccess file
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^product/([0-9]+)/?$ product.php?p_id=$1 [NC,L]

Remove last directory from URL using htaccess

My question is, How can remove last directory using htaccess rule.
http://mywedding.com/anandn/
should load content of
http://mywedding.com/anandn/theme/
OR
http://mywedding.com/mamtaandkuldip/
should load content of
http://mywedding.com/mamtaandkuldip/theme/
Thanks in advance.
Place this rule in DocumentRoot/.htaccess file:
RewriteEngine On
RewriteRule ^([^/.]+)/?$ /$1/theme/ [L]
Inside
mywedding.com/anandn/index.php
write the following code
header("location:mywedding.com/anandn/theme/");
it will redirect you to your site.

Mode_rewrite adding index.php to end of url

I want to apologize for not being a strong knowledge of the language, but I have a problem like that.
I made a redirect through mode_rewrite now url is "localhost/url/url2/" apache and it redirects to
"localhost/url/url2/index.php" how to remove from url "index.php?"
if you want to remove only index.php then put code like this in htaccess,
RewriteRule ^/$ http://localhost/url/url2/index.php
place this htaccess file where index.php is
You can use this rule:
RewriteRule ^url/url2/$ /url/url2/index.php [L]
Browser won't show index.php in the URL input.

Rewrite URL using htaccess php

I want to rewrite the url in my project.
For example:
http://www.example.com/dashboard/test/ to http://dashboard.example.com/index.php
Also I want to do it for:
http://www.example.com/dashboard/test2/ to http://dashboard.example.com/index.php
Can anyone tell me the idea to rewrite the url?
First you create a .htaccess file in your root.
Than, just put the redirect commands in it.
How to compose a .htaccess and how to create rewrite rules is explained here: http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/
You will need something like:
RewriteRule ^(.*)$ http://dashboard.example.com/$1 [L,QSA]
try this
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^test.*$ http://dashboard.example.com/index.php [R=301,L]

Want to rewrite url using htaccess

I am new to htaccess and want to do following thing,
I want to rewrite url like,
http://example.com/test/test.php to http://example.com/test.html
and my htaccess file present in test folder. Can anyone help to find out this problem.
Thank You
That should do it:
RewriteEngine on
RewriteRule ^(.*).html$ test/$1.php [QSA]

Categories